Git Product home page Git Product logo

Comments (7)

kkaefer avatar kkaefer commented on July 24, 2024

Seems calling .drain() and .destoryAllNow() together makes node-pool quit reasonably fast. It still waits for one reapInterval though.

from node-pool.

coopernurse avatar coopernurse commented on July 24, 2024

Interesting. Do you have a suggested fix? Or perhaps a failing unit test? That would help me reason through the solution.

from node-pool.

kkaefer avatar kkaefer commented on July 24, 2024

The reason I reported this is that node-pool prevents my tests from exiting cleanly in a timely fashion. I suggest savig the setTimeout's return value and calling clearTimeout when draining the pool.

from node-pool.

dougwilson avatar dougwilson commented on July 24, 2024

I actually missed this issue, but I ran into the same problem and submitted pull request #37 that fixes this.

from node-pool.

dougwilson avatar dougwilson commented on July 24, 2024

By the way, the clearing of the reap timeout belongs in destroyAllNow instead of drain because dain just waits for all objects to be returned to the pool and the reap timeout needs to be live when there are objects idle in the pool. destroyAllNow actually destroys all the objects, so since there are no longer objects to reap after a destroyAllNow then the timer can just be canceled. The following is how I end my node scripts with the pool:

pool.drain(function () {
    pool.destoryAllNow();
    // Now just waiting for no events on the even loop & exit with code 0
});

from node-pool.

ando-takahiro avatar ando-takahiro commented on July 24, 2024

@kkaefer this issue looks closed, right?

from node-pool.

sandfox avatar sandfox commented on July 24, 2024

closing this as it looks fixed in #37

from node-pool.

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.