From e0a1ecea85e6bf9640d3d590fe0254df5de653d3 Mon Sep 17 00:00:00 2001 From: mika Date: Sun, 31 Jul 2016 10:51:30 +0300 Subject: [PATCH 1/2] Dropbox: test with 1min polling --- dropbox/dropbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dropbox/dropbox.js b/dropbox/dropbox.js index bd4394d8..bf9b31c2 100644 --- a/dropbox/dropbox.js +++ b/dropbox/dropbox.js @@ -35,7 +35,7 @@ module.exports = function(RED) { function DropboxInNode(n) { RED.nodes.createNode(this,n); this.filepattern = n.filepattern || ""; - this.checkInterval = n.checkInterval || 600000; + this.checkInterval = n.checkInterval || 60000; this.dropboxConfig = RED.nodes.getNode(n.dropbox); var credentials = this.dropboxConfig ? this.dropboxConfig.credentials : {}; if (!credentials.appkey || !credentials.appsecret || From 3c1d33fa020d5606bffa2cb6b4924b42ee9c7027 Mon Sep 17 00:00:00 2001 From: mika Date: Sun, 31 Jul 2016 17:44:43 +0300 Subject: [PATCH 2/2] Dropbox in node: reset cursor after every poll (enables polling only for NEW changes) --- dropbox/dropbox.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dropbox/dropbox.js b/dropbox/dropbox.js index bf9b31c2..c607171a 100644 --- a/dropbox/dropbox.js +++ b/dropbox/dropbox.js @@ -61,10 +61,11 @@ module.exports = function(RED) { return; } node.status({}); - if (!node.state) { + if (!node.state) { // when executed for the first time only save cursor node.state = data.cursor(); } - else { + else { + node.state = data.cursor(); // reset cursor to get only changes since last poll var changes = data.changes; for (var i = 0; i < changes.length; i++) { var change = changes[i];