balena-os / balena-supervisor

Balena Supervisor: balena's agent on devices.
https://balena.io
Other
148 stars 63 forks source link

Gracefully handle multiple reboot/shutdown requests #2309

Closed cywang117 closed 5 months ago

cywang117 commented 5 months ago

Since HTTP's server.close() is async, there is a slim chance for two instances of /v1/reboot or /v1/shutdown to be processed. If the server is already closed when server.close() is called, the call throws ERR_SERVER_NOT_RUNNING which doesn't need to be surfaced to the user.

Change-type: patch

pipex commented 5 months ago

Looks good

cywang117 commented 5 months ago

@balena-ci I self-certify!