Coder Social home page Coder Social logo

Comments (6)

SGrondin avatar SGrondin commented on May 18, 2024 1

Thank you, this is great, I'll have a look as soon as I can.

from bottleneck.

SGrondin avatar SGrondin commented on May 18, 2024

All queued up and scheduled jobs are always cleared.

For the running jobs, there are 2 settings that matter:

  1. interrupt: stopAll() argument
  2. rejectOnDrop: argument passed when creating the limiter
  • If interrupt is false: The running jobs are ignored. They will complete successfully or fail on their own and the results will be passed to the callers.
  • If interrupt is true and rejectOnDrop is true: The running jobs will be rejected immediately with a failed promise. But the job itself keeps running in the background, because it's impossible to cancel function execution in JavaScript. When that job terminates, Bottleneck will ignore the result, since it has already returned a failed promise to the callers.
  • If interrupt is true and rejectOnDrop is false: the result of the running jobs will not be passed to the callers once they complete. The callers are simply left hanging.

I'm adding all of that information to the README, I hope it answered your questions.

from bottleneck.

chrisblossom avatar chrisblossom commented on May 18, 2024

Thank you for the detailed explanation.

I setup an example repo with all possible combinations of interrupt and rejectOnDrop to show what I am seeing:
https://github.com/chrisblossom/bottleneck-example

I am trying to clear the queue and letting whatever is running finish running as it normally would.

from bottleneck.

SGrondin avatar SGrondin commented on May 18, 2024

Hmm, something sticks out right away: you have the wrong number of arguments in your example.

Here you have 4 arguments and it's clear that you intended for the boolean to be rejectOnDrop's setting.

The arguments are, in order:

  • maxConcurrent (default 0)
  • minTime (default 0)
  • highWater (default -1)
  • strategy (default Bottleneck.strategy.LEAK)
  • rejectOnDrop (default false)

You can use null instead of undefined to skip an argument (and use the default).

Let me know if that fixes it, and if not I'll look it right away, I just came back from a trip.

from bottleneck.

chrisblossom avatar chrisblossom commented on May 18, 2024

Good catch! I just tried it with the correct amount of arguments and the issue is still there.

from bottleneck.

SGrondin avatar SGrondin commented on May 18, 2024

Closing this since it won't be an issue in v2, currently in beta.

from bottleneck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.