Re-vendor the shared files from sneak/prompts at 0653579 (closes #52)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Takes .golangci.yml, .dockerignore, .gitignore, .editorconfig, the workflow and REPO_POLICIES.md from sneak/prompts 0653579, with this repository's own entries after the shared content. Lint (golangci-lint v2.14.0) and test are Dockerfile phases that script/lint and script/test build alone with a new CACHEBUST value, keeping Go's and golangci-lint's caches; the image build depends on both. make fmt and make fmt-check also format the markdown with prettier, pinned in yarn.lock. The agent guidance moves to AGENTS.md. The Go code is fixed for what the new configuration finds, and the AS and prefix detail reads now return the rows' error after their loops. Model: opus-5-5
This commit was merged in pull request #85.
This commit is contained in:
+22
-11
@@ -57,14 +57,19 @@ func logDebugStats(logger *logger.Logger) {
|
||||
|
||||
// CLIEntry is the main entry point for the routewatch command-line interface.
|
||||
// It initializes the application using the fx dependency injection framework,
|
||||
// sets up signal handling for graceful shutdown, and starts the RouteWatch service.
|
||||
// This function blocks until the application receives a shutdown signal or encounters
|
||||
// a fatal error.
|
||||
// sets up signal handling for graceful shutdown, and starts the RouteWatch
|
||||
// service. This function blocks until the application receives a shutdown
|
||||
// signal or encounters a fatal error.
|
||||
func CLIEntry() {
|
||||
app := fx.New(
|
||||
getModule(),
|
||||
fx.Options(getModule()...),
|
||||
fx.StopTimeout(shutdownTimeout), // Allow 60 seconds for graceful shutdown
|
||||
fx.Invoke(func(lc fx.Lifecycle, rw *RouteWatch, logger *logger.Logger, shutdowner fx.Shutdowner) {
|
||||
fx.Invoke(func(
|
||||
lc fx.Lifecycle,
|
||||
rw *RouteWatch,
|
||||
logger *logger.Logger,
|
||||
shutdowner fx.Shutdowner,
|
||||
) {
|
||||
lc.Append(fx.Hook{
|
||||
OnStart: func(ctx context.Context) error {
|
||||
// Start debug stats logging
|
||||
@@ -77,25 +82,31 @@ func CLIEntry() {
|
||||
go func() {
|
||||
<-sigCh
|
||||
logger.Info("Received shutdown signal")
|
||||
if err := shutdowner.Shutdown(); err != nil {
|
||||
|
||||
err := shutdowner.Shutdown()
|
||||
if err != nil {
|
||||
logger.Error("Failed to shutdown gracefully", "error", err)
|
||||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
if err := rw.Run(ctx); err != nil {
|
||||
err := rw.Run(ctx)
|
||||
if err != nil {
|
||||
logger.Error("RouteWatch error", "error", err)
|
||||
if err := shutdowner.Shutdown(fx.ExitCode(failureExitCode)); err != nil {
|
||||
logger.Error("Failed to shutdown gracefully", "error", err)
|
||||
|
||||
err = shutdowner.Shutdown(fx.ExitCode(failureExitCode))
|
||||
if err != nil {
|
||||
logger.Error("Failed to shutdown gracefully",
|
||||
"error", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
},
|
||||
OnStop: func(_ context.Context) error {
|
||||
OnStop: func(ctx context.Context) error {
|
||||
logger.Info("Shutting down RouteWatch")
|
||||
rw.Shutdown()
|
||||
rw.Shutdown(ctx)
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user