Skip to content

Commit

Permalink
cherry-picked fix for issue rauchg#303
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Nov 14, 2017
1 parent 3ea5f89 commit 3700800
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/slack.js
Expand Up @@ -59,13 +59,17 @@ export default class SlackData extends EventEmitter {
return channel ? channel.id: null
}

retry (){
let interval = this.interval * 2
setTimeout(this.fetch.bind(this), interval)
this.emit('retry')
retry(delay = this.interval * 2) {
setTimeout(this.fetch.bind(this), delay);
this.emit('retry');
}

onres (err, res){
// Too Many Requests
if (res.status === 429) {
return this.retry(res.headers['retry-after'] * 1000);
}

if (err) {
this.emit('error', err)
return this.retry()
Expand Down

0 comments on commit 3700800

Please sign in to comment.