Fix crash in scheduler when profile no longer exists - #2524
Merged
Conversation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
m3nu
approved these changes
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
VortaScheduler.set_timer_for_profile()looks up the profile withBackupProfileModel.get_or_none(id=profile_id), which returnsNonewhen the profile no longer exists. There is already aif profile is None: returnguard, but thelogger.debug(...)line above it dereferencesprofile.schedule_fixed_hour/profile.schedule_fixed_minutefirst, so a missing profile crashes before the guard runs:This moves the debug log below the
Nonecheck so the guard takes effect.Related Issue
#2522
Motivation and Context
A scheduled timer can fire for a
profile_idwhose profile was deleted, which raised an unhandledAttributeErrorand broke scheduling. The fix lets the existing guard return cleanly in that case.How Has This Been Tested?
Added
test_set_timer_for_missing_profile, which callsset_timer_for_profile()with an id that has no matching profile and asserts it returns without raising and adds no timer. Tested on Linux.Screenshots (if appropriate):
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.