muni-town / weird-legacy

Local-first webpage generator
https://weird-test.krivah.me/
31 stars 7 forks source link

fix: fix weird using 100% of 2 CPU cores. #20

Closed zicklag closed 1 year ago

zicklag commented 1 year ago

There was a busy loop in the thread that ran the http server while waiting for a shutdown signal. This would cause the app to use 100% of two CPU cores while it was running.

This replaced the thread with two, one that will wait for the shutdown signal, and one that will run the server, and it uses the unblock() feature of the tiny_http server to gracefully shutdown the server when we get the shutdown signal.