Skip to content

Commit 8c81e96

Browse files
committed
Fix case when cron_jobs is None in Arq settings class
Arq settings can be defined as a dictionary or a class. When using a class inheriting from `WorkerSettingsBase`, the default value for `cron_jobs` is `None`. This causes a `TypeError: 'NoneType' object is not iterable` exception in Sentry when starting the worker. This fix is a followup to getsentry#4115 which handled the issue for the other settings formats.
1 parent b16fa5f commit 8c81e96

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sentry_sdk/integrations/arq.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,13 @@ def _sentry_create_worker(*args, **kwargs):
210210

211211
if hasattr(settings_cls, "functions"):
212212
settings_cls.functions = [
213-
_get_arq_function(func) for func in settings_cls.functions
213+
_get_arq_function(func)
214+
for func in getattr(settings_cls, "functions", [])
214215
]
215216
if hasattr(settings_cls, "cron_jobs"):
216217
settings_cls.cron_jobs = [
217-
_get_arq_cron_job(cron_job) for cron_job in settings_cls.cron_jobs
218+
_get_arq_cron_job(cron_job)
219+
for cron_job in getattr(settings_cls, "cron_jobs", [])
218220
]
219221

220222
if "functions" in kwargs:

0 commit comments

Comments
 (0)