bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

Add shutdown.

Open davidlehn opened this issue 2 years ago • 2 comments

A shutdown() API is added to perform orderly shutdown. This came about due to how bedrock-test was exiting. In the flow it uses, calling bedrock.exit() or process.exit() after successful testing results in a more abrupt shutdown. There isn't a way to exit and emit orderly events on the way. In some testing cases you may want bedrock.exit or similar events to trigger to do cleanup.

This patch attempts to keep the same semantics for current code and only adds the shutdown() call (and does some refactoring). Retaining all prior behavior in all cases isn't well tested. Help wanted.

shutdown() could be named something else or be hacked into exit() as options, but this seemed like a simple approach. At the time this was written, it wasn't named stop(), but now I can't recall the reasoning and that might be a better choice as it aligns with start/stop semantics and event naming. Comments welcome.

davidlehn avatar Oct 06 '23 04:10 davidlehn

Codecov Report

Merging #111 (c117058) into main (80edacd) will decrease coverage by 0.09%. The diff coverage is 73.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #111      +/-   ##
==========================================
- Coverage   81.45%   81.37%   -0.09%     
==========================================
  Files          10       10              
  Lines        1941     1954      +13     
==========================================
+ Hits         1581     1590       +9     
- Misses        360      364       +4     
Files Coverage Δ
lib/index.js 69.28% <73.91%> (-0.01%) :arrow_down:

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 80edacd...c117058. Read the comment docs.

codecov[bot] avatar Mar 02 '24 01:03 codecov[bot]

This does not appear to impact how Bedrock behaves when it receives a SIGTERM, is that correct?

mattcollier avatar Mar 15 '24 13:03 mattcollier