taskiq-python / taskiq

Distributed task queue with full async support
MIT License
694 stars 44 forks source link

Added unschedule possibility. #226

Closed s3rius closed 8 months ago

s3rius commented 8 months ago

This PR adds new abstraction called "CreatedSchedule". When schedule_* methods are called, the CreatedSchedule is returned. This class has methods to unschedule previously scheduled tasks.

Also, we added new method to the schedule source to remove schedules. To make this method easy to implement, we had to once again add new field schedule_id to the ScheduledTask. To make it backward compatible though, we made it with default_factory.

codecov-commenter commented 8 months ago

Codecov Report

Merging #226 (747ffe1) into develop (060dd94) will decrease coverage by 0.42%. The diff coverage is 53.33%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

@@             Coverage Diff             @@
##           develop     #226      +/-   ##
===========================================
- Coverage    73.45%   73.04%   -0.42%     
===========================================
  Files           55       56       +1     
  Lines         1646     1684      +38     
===========================================
+ Hits          1209     1230      +21     
- Misses         437      454      +17     
Files Coverage Δ
taskiq/scheduler/scheduled_task.py 92.59% <100.00%> (+0.59%) :arrow_up:
taskiq/abc/schedule_source.py 84.61% <66.66%> (-6.30%) :arrow_down:
taskiq/decor.py 84.84% <33.33%> (+0.47%) :arrow_up:
taskiq/kicker.py 67.81% <27.27%> (-4.69%) :arrow_down:
taskiq/scheduler/created_schedule.py 61.53% <61.53%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more