Skip to content

Commit

Permalink
Merge pull request #878 from Icinga/ha-realize-tx-conn
Browse files Browse the repository at this point in the history
HA: Use Transaction for each query
  • Loading branch information
lippserd authored Dec 17, 2024
2 parents accf30b + fc87369 commit 443150b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/icingadb/ha.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (h *HA) realize(
// Insert the environment after each heartbeat takeover if it does not already exist in the database
// as the environment may have changed, although this is likely to happen very rarely.
stmt, _ = h.db.BuildInsertIgnoreStmt(h.environment)
if _, err := h.db.NamedExecContext(ctx, stmt, h.environment); err != nil {
if _, err := tx.NamedExecContext(ctx, stmt, h.environment); err != nil {
return database.CantPerformQuery(err, stmt)
}
}
Expand Down

0 comments on commit 443150b

Please sign in to comment.