-
-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Milestone
Description
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.Injectoralso implementcontext.Context, and - Add
func do.InvokeContext[T](context.Context, do.Injector)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels