Delay Dropbox polling by 5 seconds and dispatch only a single request

This commit is contained in:
James Allen
2014-08-14 13:48:23 +01:00
parent 7816810249
commit 9be7228247
3 changed files with 98 additions and 22 deletions
@@ -10,6 +10,10 @@ module.exports = DropboxWebhookController =
logger.log dropbox_uids: dropbox_uids, "received webhook request from Dropbox"
if !dropbox_uids?
return res.send(400) # Bad Request
# Do this in the background so as not to keep Dropbox waiting
DropboxWebhookHandler.pollDropboxUids dropbox_uids, (error) ->
return next(error) if error?
res.send(200)
if error?
logger.error err: error, dropbox_uids: dropbox_uids, "error in webhook"
res.send(200)