npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

task-backoff

1.0.1

@mafintosh

npmHomeRepoSnykSocket
Downloads:2832
$ npm install task-backoff
DailyWeeklyMonthlyYearly

task-backoff

Small module to do smart delays in tight loops to maintain a certain event loop delay

npm install task-backoff

Usage

const TaskBackoff = require('task-backoff')

const t = new TaskBackoff({ maxDelay: 100 })

let i = 0
while (true) {
  if (t.backoff()) await t.wait()
  console.log('gogo', i++, t.delay())
}

License

Apache-2.0