diff options
-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") |