From 15b347c0cad0612e396c0083efadc0c05aa9b54f Mon Sep 17 00:00:00 2001 From: Felix Schauerte Date: Thu, 28 Apr 2016 13:59:52 +0200 Subject: [PATCH 1/2] The change avoids unnecessary pushes. We are running into serious problems with the following scenario: When a user logs in the first time, we create a user specific couch db and insert some design documents to that db. this is realized via a separate node process with nano. In this case, the couch-daemon (we use couchmagick) gets a massive bulk of events (creation of new db, updates for several design documents, etc.). I don't know why, but then the new db is not watched by couch-daemon, if if the dbs name is covered by the whitelist (/.*/ on our case). Applying the above patch avoids the problem. --- lib/dbs.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/dbs.js b/lib/dbs.js index 1214c16..ba551f0 100644 --- a/lib/dbs.js +++ b/lib/dbs.js @@ -74,10 +74,8 @@ module.exports = function(url, options) { // * deleted // Ignore 'updated' events. feed.on('change', function(change) { - if (change.type === 'updated') { - return; - } - push(null, _.extend({ stream: 'dbs' }, change)); + if (change.type === 'updated' || change.type === 'created') + push(null, _.extend({ stream: 'dbs' }, change)); }); feed.on('error', push); feed.follow(); From eb074e865ff4ec6ff8b6f055562c684684cf3584 Mon Sep 17 00:00:00 2001 From: Felix Schauerte Date: Thu, 28 Apr 2016 14:39:10 +0200 Subject: [PATCH 2/2] The change avoids unnecessary pushes. We are running into serious problems with the following scenario: When a user logs in the first time, we create a user specific couch db and insert some design documents to that db. this is realized via a separate node process with nano. In this case, the couch-daemon (we use couchmagick) gets a massive bulk of events (creation of new db, updates for several design documents, etc.). I don't know why, but then the new db is not watched by couch-daemon, if if the dbs name is covered by the whitelist (/.*/ on our case). Applying the above patch avoids the problem. --- lib/dbs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dbs.js b/lib/dbs.js index ba551f0..c71bd07 100644 --- a/lib/dbs.js +++ b/lib/dbs.js @@ -74,7 +74,7 @@ module.exports = function(url, options) { // * deleted // Ignore 'updated' events. feed.on('change', function(change) { - if (change.type === 'updated' || change.type === 'created') + if (change.type === 'deleted' || change.type === 'created') push(null, _.extend({ stream: 'dbs' }, change)); }); feed.on('error', push);