Skip to content

Commit 5101bcd

Browse files
authored
fix(taskworker): Have the option call actually use options (#93638)
Fix a bug where instead of checking the options DB a local options variable was being accessed.
1 parent fd161e3 commit 5101bcd

File tree

1 file changed

+5
-2
lines changed
  • src/sentry/runner/commands

1 file changed

+5
-2
lines changed

src/sentry/runner/commands/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def taskworker_scheduler(redis_cluster: str, **options: Any) -> None:
255255
"""
256256
from django.conf import settings
257257

258+
from sentry import options as featureflags
258259
from sentry.taskworker.registry import taskregistry
259260
from sentry.taskworker.scheduler.runner import RunStorage, ScheduleRunner
260261
from sentry.utils.redis import redis_clusters
@@ -266,7 +267,7 @@ def taskworker_scheduler(redis_cluster: str, **options: Any) -> None:
266267

267268
with managed_bgtasks(role="taskworker-scheduler"):
268269
runner = ScheduleRunner(taskregistry, run_storage)
269-
enabled_schedules = set(options.get("taskworker.scheduler.rollout", []))
270+
enabled_schedules = set(featureflags.get("taskworker.scheduler.rollout", []))
270271
for key, schedule_data in settings.TASKWORKER_SCHEDULES.items():
271272
if key in enabled_schedules:
272273
runner.add(key, schedule_data)
@@ -479,6 +480,8 @@ def cron(**options: Any) -> None:
479480
"Run periodic task dispatcher."
480481
from django.conf import settings
481482

483+
from sentry import options as featureflags
484+
482485
if settings.CELERY_ALWAYS_EAGER:
483486
raise click.ClickException(
484487
"Disable CELERY_ALWAYS_EAGER in your settings file to spawn workers."
@@ -488,7 +491,7 @@ def cron(**options: Any) -> None:
488491

489492
old_schedule = app.conf.CELERYBEAT_SCHEDULE
490493
new_schedule = {}
491-
task_schedules = set(options.get("taskworker.scheduler.rollout", []))
494+
task_schedules = set(featureflags.get("taskworker.scheduler.rollout", []))
492495
for key, schedule_data in old_schedule.items():
493496
if key not in task_schedules:
494497
new_schedule[key] = schedule_data

0 commit comments

Comments
 (0)