Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
[Backport 5.3] dynamically select only for pg_stat_activity with datn…
Browse files Browse the repository at this point in the history
…ame from the ap… (#60773)

dynamically select only for pg_stat_activity with datname from the ap… (#60771)

dynamically select only for pg_stat_activity with datname from the application making the request i.e. sourcegraph-autoupgrader

(cherry picked from commit d04f2fd)

Co-authored-by: Warren Gifford <[email protected]>
  • Loading branch information
sourcegraph-release-bot and DaedalusG authored Mar 8, 2024
1 parent c2d3d3d commit 9bc9f75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/frontend/internal/cli/autoupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func heartbeatLoop(logger log.Logger, db database.DB) (func(), error) {

func checkForDisconnects(ctx context.Context, _ log.Logger, db database.DB) (remaining []string, err error) {
query := sqlf.Sprintf(`SELECT DISTINCT(application_name) FROM pg_stat_activity
WHERE application_name <> '' AND application_name <> %s AND application_name <> 'psql'`,
WHERE application_name <> '' AND application_name <> %s AND application_name <> 'psql' AND datname = current_database()`,
appName)
store := basestore.NewWithHandle(db.Handle())
remaining, err = basestore.ScanStrings(store.Query(ctx, query))
Expand Down

0 comments on commit 9bc9f75

Please sign in to comment.