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
Ox offers a nice way to manage resources in scopes:
supervised {
valserverBinding= useInScope(NettySyncServer().addEndpoints(endpoints).start())(_.stop())
//...
never
}
The release clause (_.stop()) is run only if the scope fails due to an unhandled exception. We often deal with long-living resources which should get released on server shutdown, which typically means a TERM signal to the JVM, handled by a shutdown hook.
This is handled in Cats Effect by IOApp, where users can compose resources into a final effectIO[ExitCode]. In case of runtime shutdown,main fiber will be canceled and resource finalizers will be called.
Maybe we can somehow achieve a similar effect in Ox? There is no notion of App, main fiber etc., but I'm leaving this issue as a remark that using resources in scopes has this particular limitation.
The text was updated successfully, but these errors were encountered:
Ox offers a nice way to manage resources in scopes:
The release clause (
_.stop()
) is run only if the scope fails due to an unhandled exception. We often deal with long-living resources which should get released on server shutdown, which typically means a TERM signal to the JVM, handled by a shutdown hook.This is handled in Cats Effect by
IOApp
, where users can compose resources into a final effectIO[ExitCode]
. In case of runtime shutdown,main fiber will be canceled and resource finalizers will be called.Maybe we can somehow achieve a similar effect in Ox? There is no notion of
App
,main fiber
etc., but I'm leaving this issue as a remark that using resources in scopes has this particular limitation.The text was updated successfully, but these errors were encountered: