diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2025-02-22 14:23:28 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2025-02-22 14:23:28 -0500 |
commit | 80ea0bf9e3f481b8ea813aefaa4de3b803b9f4ba (patch) | |
tree | 1e85b8536aa90746a0b97dc9467918ef135ccbb2 | |
parent | 4221780ce53ff7484f6f1958173373dc963e7967 (diff) |
-rw-r--r-- | internal/app/action.go | 10 | ||||
-rw-r--r-- | internal/db/setup.go | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/internal/app/action.go b/internal/app/action.go index 78bb251..59d0f9a 100644 --- a/internal/app/action.go +++ b/internal/app/action.go @@ -54,11 +54,9 @@ func action(ctx context.Context, cmd *cli.Command) error { } brutalShutdown = func() { - once.Do(func() { // Ensure graceful shutdown isn't re-executed - slog.WarnContext(ctx, "Graceful shutdown delay exceeded, shutting down NOW!") - server.Stop() - store.Close() - }) + slog.WarnContext(ctx, "Graceful shutdown delay exceeded, shutting down NOW!") + server.Stop() + store.Close() } port := fmt.Sprintf(":%d", cmd.Int(FlagListenPort)) @@ -90,9 +88,9 @@ func action(ctx context.Context, cmd *cli.Command) error { go gracefulShutdown() select { - case <-shutdownDone: // If graceful shutdown completes in time, exit normally case <-time.After(cmd.Duration(FlagGraceTimeout)): // Timeout exceeded brutalShutdown() + case <-shutdownDone: // If graceful shutdown completes in time, exit normally } running = false } diff --git a/internal/db/setup.go b/internal/db/setup.go index ff56233..26f40f2 100644 --- a/internal/db/setup.go +++ b/internal/db/setup.go @@ -59,8 +59,8 @@ func opts() string { } // Setup opens the SQLite DB at path, verifies its integrity and schema, -// and returns the valid DB handle. If any check fails, it backs up the old file -// and reinitializes the DB using the schema definitions. +// and returns the valid DB handle. If any check fails, it backs up the old +// file and reinitializes the DB using the schema definitions. func Setup(ctx context.Context, path string) (*Store, error) { slog.DebugContext(ctx, "Setting up database connection") |