You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
service.register(label:"thing",
start:.sync {print("THIS WILL FAIL")structSomeError:Error{}throwSomeError()},
shutdown:.sync {print("SHUTDOWN <<< SHOULD NEVER HAPPEN")},
shutdownIfNotStarted:false)try service.startAndWait()
clearly, it should never invoke the shutdown handler because the start one failed but it still will. It prints:
THIS WILL FAIL
SHUTDOWN <<< SHOULD NEVER HAPPEN
The text was updated successfully, but these errors were encountered:
@weissi iirc the design thought was that you may have created some state before failing that you want to clean up. obviously this is not always the case. is this behavior causing you issues? ideas on how to trade these off?
@weissi iirc the design thought was that you may have created some state before failing that you want to clean up. obviously this is not always the case. is this behavior causing you issues? ideas on how to trade these off?
I thought the idea was that if you have created the state already, then you use registerShutdown which will unconditionally be called. But if you use register(..., start:, shutdown:) then I would've expected shutdown not to be called if start failed. Is there a situation where you would want shutdown to be called when start failed?
Especially given that I set shutdownIfNotStarted: false I really wouldn't have expected it to shut down if start failed.
consider this code
clearly, it should never invoke the
shutdown
handler because thestart
one failed but it still will. It prints:The text was updated successfully, but these errors were encountered: