Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Load scripts in main thread on server start

Open duffmansjnr-hub opened this issue 2 months ago • 2 comments

Suggestion

I think when the server starts, scripts should be always be loaded main threaded (even if the config says load async).

Why?

I think that when the server starts it should load main thread because right now when the server starts, it currently loads to slow which makes some players join earlier then expected and the skript does not have time to load the big files of the skript.

Other

N/A

Agreement

  • [x] I have read the guidelines above and affirm I am following them with this suggestion.

duffmansjnr-hub avatar Nov 28 '25 20:11 duffmansjnr-hub

I don't think we should push the loading to main thread, but we should have a block on the main thread until loading finishes. That should better support parallel loading too.

sovdeeth avatar Nov 28 '25 22:11 sovdeeth

I don't think we should push the loading to main thread, but we should have a block on the main thread until loading finishes. That should better support parallel loading too.

Unfortunately this idea will not work, since async loading calls tasks synchronously throughout the process, meaning a block just causes a deadlock. The original idea of forcing the first load on the main thread is viable, though we will have to do some shenanigans with things that check if the loader is async, like the auto-reload syntax. It will fail to parse on startup because the loader was forced to be sync, which kind of defeats the whole purpose.

sovdeeth avatar Dec 11 '25 07:12 sovdeeth