Skip to content

Commit

Permalink
ref(debug-files): Buffer updates to reprocessing revision project opt…
Browse files Browse the repository at this point in the history
…ion (#29041)
  • Loading branch information
beezz authored Oct 4, 2021
1 parent bf6292e commit 186767c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/sentry/receivers/reprocessing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from sentry.models import ProjectOption
from sentry.signals import buffer_incr_complete


@buffer_incr_complete.connect(
sender=ProjectOption, dispatch_uid="bump_reprocessing_revision_receiver", weak=False
)
def bump_reprocessing_revision_receiver(filters, **_):
from sentry.reprocessing import REPROCESSING_OPTION, bump_reprocessing_revision

if filters.get("key") == REPROCESSING_OPTION:
bump_reprocessing_revision(filters["project"], use_buffer=False)
13 changes: 11 additions & 2 deletions src/sentry/reprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,21 @@ def get_reprocessing_revision(project, cached=True):
pass


def bump_reprocessing_revision(project):
def bump_reprocessing_revision(project, use_buffer=False):
"""Bumps the reprocessing revision."""
from sentry import buffer
from sentry.models import ProjectOption

rev = uuid.uuid4().hex
ProjectOption.objects.set_value(project, REPROCESSING_OPTION, rev)
if use_buffer:
buffer.incr(
ProjectOption,
columns={},
filters={"project": project, "key": REPROCESSING_OPTION},
signal_only=True,
)
else:
ProjectOption.objects.set_value(project, REPROCESSING_OPTION, rev)
return rev


Expand Down
2 changes: 1 addition & 1 deletion src/sentry/tasks/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def assemble_dif(project_id, name, checksum, chunks, debug_id=None, **kwargs):
# and might resolve processing issues. If the file was not
# created, someone else has created it and will bump the
# revision instead.
bump_reprocessing_revision(project)
bump_reprocessing_revision(project, use_buffer=True)
except Exception:
set_assemble_status(
AssembleTask.DIF,
Expand Down

0 comments on commit 186767c

Please sign in to comment.