Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/sentry/models/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def increment_project_counter(project, delta=1, using="default"):
if settings.SENTRY_PROJECT_COUNTER_STATEMENT_TIMEOUT:
# WARNING: This is not a proper fix and should be removed once
# we have better way of generating next_short_id.
cur.execute("show statement_timeout")
statement_timeout = cur.fetchone()[0]
cur.execute(
"set local statement_timeout = %s",
[settings.SENTRY_PROJECT_COUNTER_STATEMENT_TIMEOUT],
Expand All @@ -64,7 +66,16 @@ def increment_project_counter(project, delta=1, using="default"):
[project.id, delta],
)

return cur.fetchone()[0]
project_counter = cur.fetchone()[0]

if settings.SENTRY_PROJECT_COUNTER_STATEMENT_TIMEOUT:
cur.execute(
"set local statement_timeout = %s",
[statement_timeout],
)

return project_counter

finally:
cur.close()

Expand Down