Skip to content

Commit 87063c8

Browse files
authored
fix(symbolicator): Correctly start tasks asynchronously (#29048)
1 parent 1479539 commit 87063c8

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/sentry/tasks/low_priority_symbolication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _scan_for_suspect_projects() -> None:
3434

3535
for project_id in realtime_metrics.projects():
3636
suspect_projects.add(project_id)
37-
update_lpq_eligibility(project_id).apply_async()
37+
update_lpq_eligibility.delay(project_id=project_id)
3838

3939
# Prune projects we definitely know shouldn't be in the queue any more.
4040
# `update_lpq_eligibility` should handle removing suspect projects from the list if it turns
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
import pytest
22

3-
from sentry.tasks.low_priority_symbolication import calculation_magic
3+
from sentry.processing import realtime_metrics
4+
from sentry.tasks.low_priority_symbolication import _scan_for_suspect_projects, calculation_magic
5+
from sentry.testutils.helpers.task_runner import TaskRunner
46
from sentry.utils import redis
7+
from sentry.utils.compat import mock
58

69

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

1114

15+
@mock.patch("sentry.tasks.low_priority_symbolication.calculation_magic", lambda x, y: True)
16+
def test_scan_for_suspect_projects() -> None:
17+
realtime_metrics.increment_project_event_counter(17, 0)
18+
with TaskRunner():
19+
_scan_for_suspect_projects()
20+
assert realtime_metrics.get_lpq_projects() == {17}
21+
22+
1223
def test_calculation_magic():
1324
assert not calculation_magic([], [])

0 commit comments

Comments
 (0)