Sign in to follow this  
seelrd

RageMP wrongly thinks it is started twice

Recommended Posts

Hello,

As you can see on the following image, RageMP server thinks it is started twice (or more times) using a nodejs module called threads.js: Click here to view the image.

const spawn = require('threads').spawn;
spawn("test.js");

Run the code above in a package with something in the test.js file and RageMP will behave in a quite strange way.

Edited by seelrd

Share this post


Link to post
Share on other sites

Information

The reason why threads.js would be good is the following: server developers would be able to start and stop resources (JS files) while running the server, so they wouldn't need to restart the server to replace the scripts. This makes installing updates (like bugfixes) possible with players on the server (without kicking them). I want to create a system like Multi Theft Auto (San Andreas) where you can dynamically start and stop resources.

Share this post


Link to post
Share on other sites
20 hours ago, seelrd said:

As you can see on the following image, RageMP server thinks it is started twice (or more times)

It doesn't just think so, threads.js actually starts multiple process instances.

Share this post


Link to post
Share on other sites

Isn't it possible to have multiple nodejs children processes having only the main one directly attached to RageMP? 

(Or it would also be awesome to have some other way to restart packages/scripts without restarting the server like with thread.kill().)

Edited by seelrd

Share this post


Link to post
Share on other sites

For example, the most popular Grand Theft Auto multiplayer modification, Multi Theft Auto (San Andreas) has resources (with server developers' scripts) that can be started and stopped any time while the server is running. That's why we wanted something like that in RageMP. Thank you for your answers. 

Share this post


Link to post
Share on other sites
5 minutes ago, seelrd said:

has resources (with server developers' scripts) that can be started and stopped any time while the server is running. That's why we wanted something like that in RageMP.

 

What does it have with threads.js? Use shouldn't use it for this purpose as it's for different kind of things.

Share this post


Link to post
Share on other sites

It seemed to be the easiest solution of completely shutting down a running script. Deleting the cache of a script loaded with require() doesn't stop (for example) the timers and event handlers in the loaded script. Another way can be if all of the scripts loaded with require() have a function that has to be called to stop/unload everything, but doing that takes much more time (of the developers' time). Do you have some idea how to do that? 

Edited by seelrd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.