-
Notifications
You must be signed in to change notification settings - Fork 5
Add unschedule method to remove jobs by name #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,3 +51,7 @@ async def morning_update() -> None: | |
| def start(self) -> None: | ||
| """Start the scheduler.""" | ||
| self.scheduler.start() | ||
|
|
||
| def unschedule(self, name: str) -> None: | ||
| """Remove a registered job by its name.""" | ||
| self.jobs = [job for job in self.jobs if job.name != name] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you can see in line 17 of this file, the function So, because of the You should also always run your changes locally to ensure your implementation works as expected. Running this PR locally would have also shown that this isn’t valid, as the build would have failed. Lastly, I don’t think the list comprehension is actually doing what it is supposed to do. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more logical to have this function after the
schedulefunction rather than at the end of the file. This will ensure that whomever is reading the file can read it like a story.