Skip to content

Commit

Permalink
feat: improve PG database initialization errors
Browse files Browse the repository at this point in the history
  • Loading branch information
acaloiaro committed Feb 22, 2024
1 parent 94d7d68 commit c16dd3d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backends/postgres/postgres_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func Backend(ctx context.Context, opts ...neoq.ConfigOption) (pb neoq.Neoq, err

err = p.initializeDB()
if err != nil {
return
return nil, fmt.Errorf("unable to initialize jobs database: %w", err)
}

if p.pool == nil { //nolint: nestif
Expand Down Expand Up @@ -175,13 +175,14 @@ func Backend(ctx context.Context, opts ...neoq.ConfigOption) (pb neoq.Neoq, err

p.pool, err = pgxpool.NewWithConfig(ctx, poolConfig)
if err != nil {
return
return nil, fmt.Errorf("unable to create worker connection pool: %w", err)
}
}

p.listenerConn, err = p.newListenerConn(ctx)
if err != nil {
p.logger.Error("unable to initialize listener connection", slog.Any("error", err))
return nil, fmt.Errorf("unable to create neoq listener connection: %w", err)
}

// monitor handlers for changes and LISTEN when new queues are added
Expand Down

0 comments on commit c16dd3d

Please sign in to comment.