فهرست منبع

Do nothing if there is trouble connecting to a db

Zane Kansil 10 سال پیش
والد
کامیت
b0e2a5140a
2فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 2 1
      frameworks/JavaScript/nodejs/handlers/mongodb-raw.js
  2. 1 1
      frameworks/JavaScript/nodejs/handlers/redis.js

+ 2 - 1
frameworks/JavaScript/nodejs/handlers/mongodb-raw.js

@@ -6,7 +6,8 @@ var collections = {
   Fortune: null
 };
 MongoClient.connect('mongodb://127.0.0.1/hello_world?maxPoolSize=5', function (err, db) {
-  if (err) { return process.exit(1) }
+  // do nothing if there is err connecting to db
+
   collections.World = db.collection('world');
   collections.Fortune = db.collection('fortune');
 });

+ 1 - 1
frameworks/JavaScript/nodejs/handlers/redis.js

@@ -8,7 +8,7 @@ var client = redis.createClient();
 
 client.on('error', function (err) {
   console.log('Redis Error: ' + err);
-  process.exit(1);
+  // Do nothing further if Redis errors/is unavailable
 });
 
 function redisWorldId(id) {