-
Notifications
You must be signed in to change notification settings - Fork 89
Description
Using a scheduler inside a loop:

The thing that I'm scheduling is definitely a function, returns a promise. Adding Promise.resolve() doesn't help.
Reading the gotchas, if I put the loop inside the scheduler then the nothing gets throttled and the remote API is overwhelmed and throws errors.
Error on the code shown:
/Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:141
passed = yield chained != null ? chained.schedule(_this.options, _this.task, ..._this.args) : _this.task(..._this.args);
^
TypeError: _this.task is not a function
at /Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:141:109
at Generator.next ()
at asyncGeneratorStep (/Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:3:103)
at _next (/Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:5:194)
at /Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:5:364
at new Promise ()
at /Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:5:97
at Job.doExecute (/Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Job.js:156:7)
at Timeout._onTimeout (/Users/wdecorte/GitHub/twentyonezero-embeddings/node_modules/bottleneck/lib/Bottleneck.js:199:22)
at listOnTimeout (node:internal/timers:573:17)