Skip to content

Commit

Permalink
fix(symbolicator): Correctly start tasks asynchronously (#29048)
Browse files Browse the repository at this point in the history
  • Loading branch information
relaxolotl authored Oct 5, 2021
1 parent 1479539 commit 87063c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sentry/tasks/low_priority_symbolication.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _scan_for_suspect_projects() -> None:

for project_id in realtime_metrics.projects():
suspect_projects.add(project_id)
update_lpq_eligibility(project_id).apply_async()
update_lpq_eligibility.delay(project_id=project_id)

# Prune projects we definitely know shouldn't be in the queue any more.
# `update_lpq_eligibility` should handle removing suspect projects from the list if it turns
Expand Down
13 changes: 12 additions & 1 deletion tests/sentry/tasks/test_low_priority_symbolication.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import pytest

from sentry.tasks.low_priority_symbolication import calculation_magic
from sentry.processing import realtime_metrics
from sentry.tasks.low_priority_symbolication import _scan_for_suspect_projects, calculation_magic
from sentry.testutils.helpers.task_runner import TaskRunner
from sentry.utils import redis
from sentry.utils.compat import mock


@pytest.fixture
def redis_cluster() -> redis._RedisCluster:
return redis.redis_clusters.get("default")


@mock.patch("sentry.tasks.low_priority_symbolication.calculation_magic", lambda x, y: True)
def test_scan_for_suspect_projects() -> None:
realtime_metrics.increment_project_event_counter(17, 0)
with TaskRunner():
_scan_for_suspect_projects()
assert realtime_metrics.get_lpq_projects() == {17}


def test_calculation_magic():
assert not calculation_magic([], [])

0 comments on commit 87063c8

Please sign in to comment.