Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: _this.task is not a function #224

Open
wimdecorte opened this issue Jun 5, 2024 · 0 comments
Open

TypeError: _this.task is not a function #224

wimdecorte opened this issue Jun 5, 2024 · 0 comments

Comments

@wimdecorte
Copy link

Using a scheduler inside a loop:

image

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant