mc-router icon indicating copy to clipboard operation
mc-router copied to clipboard

Could a --routes-refresh parameter be implemented?

Open Codrax opened this issue 1 year ago • 5 comments

I would like to run around 10 servers simultaneously, and currently, to add/remove a server I need to change the config.json. And the proxy need to be closed and re-opened to index the changes.

With a --routes-refresh parameter, optionally taking a second input for how often to refresh the routes, the application could compare the last stored modification date of the file provided with --routes-config.

This would allow the server list to be updated gracefully without restarting all servers.

Thank you!

Codrax avatar Mar 02 '24 15:03 Codrax

That's a great idea!

itzg avatar Mar 02 '24 15:03 itzg

@Codrax with this library it looks like I could have it watch for file changes. Would that be even better or still prefer/recommend a timer based approach?

itzg avatar Mar 03 '24 22:03 itzg

@Codrax with this library it looks like I could have it watch for file changes. Would that be even better or still prefer/recommend a timer based approach?

Both cases would be great as long as the file reloads. I don't know a lot about that library, but I'm pretty sure the timer based approach is simpler as that just utilises the CPUs task scheduler, which I think is more optimised. But both options are valid.

Codrax avatar Mar 04 '24 05:03 Codrax

at lest for the fsnotify backend for linux the CPU over head is very little

zarlo avatar Apr 14 '24 05:04 zarlo

at lest for the fsnotify backend for linux the CPU over head is very little

Right. It's driven by existing filesystem OS events, so there's virtually no extra overhead.

itzg avatar Apr 14 '24 13:04 itzg