Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved start (async/await) #6

Closed
wants to merge 1 commit into from

Conversation

AlinaNova21
Copy link
Contributor

@AlinaNova21 AlinaNova21 commented Feb 12, 2018

This is an improved version of the start part of the launcher.

It adds a few helpful features (forwarding console to terminal, better logging structure)
And also adds a few performance improving features (restart interval for runners/processors, option to disable storage when using alternative storage mods)
With Node 8, async/await runs natively, the code is restructured slightly to use them, this simplified some of the code and in general makes promises easier to work with. (I can try refactoring into a PR without async/await if this isn't desirable)

  • Use async/await, this simplifies some of the code
  • Added log_console option, forwards console messages to terminal
  • Changed logs to use a rotating log rather than timestamps, this makes finding the most recent log much easier. (log_rotate_keep (default 5) controls how many to keep)
  • Added a storage_enabled option (default true), this allows storage to be disabled when using a mod such as screepsmod-mongo
  • Added restart_interval (default 3600 seconds (1hr)). This is the interval before runner and processors get restarted.

@artch
Copy link
Contributor

artch commented Feb 12, 2018

This looks interesting. Do we really need to use async/await here? It'd be the only place in this code base that raises overall minimum requirement to Node.js 8.

@AlinaNova21
Copy link
Contributor Author

Not really, regular .then usage should work here, I started by modifying the launcher for personal use, I'm always hacking it in node_modules to change some things such as disabling storage and redirecting logs to stdout. I should be able to switch it back though.

As another thought, isolatedVM only compiles for newer node versions last I tried, is that not going to be setting a hard requirement for Node 8 then?

@tedivm
Copy link

tedivm commented Feb 12, 2018

Due to better performance, and the fact that node8 is the current LTS version, we've already been recommending to people in slack who are running their own servers to use node8. I believe some of the community mods are also targeting node8 and are ignoring backwards compatibility. I really don't think changing this will disrupt much.

@AlinaNova21 AlinaNova21 changed the title Improved start Improved start (async/await) Feb 12, 2018
* Use async/await, this simplifies some of the code
* Added log_console option, forwards console messages to terminal
* Changed logs to use a rotating log rather than timestamps, this makes
finding the most recent log much easier. (log_rotate_keep (default 5)
controls how many to keep)
* Added a storage_enabled option (default true), this allows storage
to be disabled when using a mod such as screepsmod-mongo
* Added restart_interval (default 3600). This is the interval before
runner and processors get restarted.
@AlinaNova21
Copy link
Contributor Author

Rebased on current launcher master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants