Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: do.Shutdown returning shutdown time ? #32

Open
samber opened this issue Mar 28, 2023 · 1 comment
Open

Proposal: do.Shutdown returning shutdown time ? #32

samber opened this issue Mar 28, 2023 · 1 comment
Milestone

Comments

@samber
Copy link
Owner

samber commented Mar 28, 2023

My monolith application relies a lot on do.Shutdownable interface. Some tasks call database or third-parties, and flush buffer.

I would like to measure the time of the do.Shutdown processing.

API proposal: duration, err := do.Shutdown()

duration would be either a time.Duration or:

type ShutdownDuration struct {
    All time.Duration
    Services map[string]time.Duration
}

WDYT ?

@GreyXor
Copy link
Contributor

GreyXor commented May 2, 2023

Hello, thanks for this proposal. I like this idea, my 2 cents here is :

If we already return information about the shutdown, perhaps we can also return several other informations. e.g. the number of services actually closed, the time elapsed, potential errors.
My proposal :
shutdownFeedback, err := do.Shutdown()

type ShutdownFeedback struct {
    All time.Duration
    Services map[string]time.Duration
    ServicesError map[string]error // each errors returned by each services shutdown
    servicesTurnedOff int
   // maybe something else ?
}

@samber samber mentioned this issue Oct 23, 2023
50 tasks
@samber samber added this to the v2 milestone May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants