Skip to content

fix: stale task handling#122

Open
ajasnosz wants to merge 1 commit into
developfrom
fix/reset-stale-tasks
Open

fix: stale task handling#122
ajasnosz wants to merge 1 commit into
developfrom
fix/reset-stale-tasks

Conversation

@ajasnosz

@ajasnosz ajasnosz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Fix the issue with stale task in celery, after resetting the scsnmp configuration, with deleted redis pvc, but kept mongodb configuration.
SC4SNMP: splunk/splunk-connect-for-snmp#1458

"""
record = list(mongo_config_collection.find())[0]
if not record["currently_scheduled"] and request["schedule_new_job"]:
currently_scheduled = record["currently_scheduled"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently_scheduled is always in the record? maybe it would be better to use .get for safety?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is always in the record, as we add it with init in ApplyChanges class.

if not record["currently_scheduled"] and request["schedule_new_job"]:
currently_scheduled = record["currently_scheduled"]
if currently_scheduled and not self._is_task_still_scheduled(record.get("task_id")):
current_app.logger.info(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be on a WARNING level? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants