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
Currently, do provides a Shutdown API for shutting down which can perform I/O or long-running operations, and ShutdownWithContext exists to allow the user to pass their context down to those operations. However, there isn't a Start equivalent for initializing services. As a result, the constructor is the only place to perform service initialization.
A problem arises when the constructor also tries to perform I/O or long-running operations, such as connecting to a database. There isn't a way to pass the user's context to those operations during construction. In my opinion, the easiest solution to this problem would be to:
Make do.Injector also implement context.Context, and
Currently, do provides a
Shutdown
API for shutting down which can perform I/O or long-running operations, andShutdownWithContext
exists to allow the user to pass their context down to those operations. However, there isn't aStart
equivalent for initializing services. As a result, the constructor is the only place to perform service initialization.A problem arises when the constructor also tries to perform I/O or long-running operations, such as connecting to a database. There isn't a way to pass the user's context to those operations during construction. In my opinion, the easiest solution to this problem would be to:
do.Injector
also implementcontext.Context
, andfunc do.InvokeContext[T](context.Context, do.Injector)
The text was updated successfully, but these errors were encountered: