Giter Club home page Giter Club logo

Comments (9)

aiselp avatar aiselp commented on August 25, 2024
let i = 0
setInterval(() => {
  i++;
  if (i>5){
    process.exit()
  }
}, 1000);

In the current situation, even if nodeRuntime is closed and the await call has exited, the code will continue to run.

from javet.

caoccao avatar caoccao commented on August 25, 2024

That's the nature of Node.js. If you run the same code in Node.js, it keeps running as well.

from javet.

aiselp avatar aiselp commented on August 25, 2024

Understand, Java applications are usually executed in a single process, while NodeJS is multi-process

from javet.

caoccao avatar caoccao commented on August 25, 2024

The following API has been added to address this issue. I believe it will resolve the issue you met. Please wait for the next release and let me know if you have any questions.

NodeRuntime.isStopping()
NodeRuntime.setStopping()

from javet.

aiselp avatar aiselp commented on August 25, 2024

I'm not sure why the previous setPurgeEventLoopBeforeClose was deleted. If it's because multiple NodeRuntimes share a single node event loop, then this method may not solve the fundamental problem. I'm worried that the remaining events may continue to run in other NodeRuntimes.
My current solution is to get all ids by modifying the setTimeout related functions, and finally clear them all when closing the NodeRuntime

from javet.

caoccao avatar caoccao commented on August 25, 2024

It was a complete redesign in Javet, so that API was removed as part of the old design.

Just try the snapshot one. The event loop is skipped completely.

from javet.

aiselp avatar aiselp commented on August 25, 2024

Great, that's definitely a better way

from javet.

aiselp avatar aiselp commented on August 25, 2024

There is another problem I am currently facing. After creating an es module, I want to set some content on import.meta, but I have no way to get this object

from javet.

caoccao avatar caoccao commented on August 25, 2024

Please create another issue with detailed info, or ping me at discord.

from javet.

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.