-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(taskworker) Remove usage of Task.signature() and Task.s() #88480
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
Conversation
Remove usage of these celery features as we don't have them implemented in taskbroker, and given the number and kind of usage these methods are getting we've decided to not implement them for taskworkers. Refs #88088
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #88480 +/- ##
===========================================
+ Coverage 56.29% 87.75% +31.45%
===========================================
Files 10001 10011 +10
Lines 566436 567351 +915
Branches 22270 22270
===========================================
+ Hits 318860 497862 +179002
+ Misses 247157 69070 -178087
Partials 419 419 |
We can't use lambda in a loop because closures retain the last value.
Introduce an intermediary function to solve lambdas closing over incorrect loop values.
def _schedule_trigger_action( | ||
action_id: int, incident_id: int, project_id: int, method: str, new_status: int | ||
) -> None: | ||
from sentry.incidents.tasks import handle_trigger_action | ||
|
||
transaction.on_commit( | ||
lambda: handle_trigger_action.delay( |
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.
I don't love these additional values, but lambda
defined in a loop end up closing over the last iteration item, and the additional function layer ensures that the lambda
closes over the correct value.
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.
Makes sense to me.
Remove usage of these celery features where we don't need to be using them. Refs #88088
Remove usage of these celery features where we don't need to be using them. Refs #88088
Remove usage of these celery features where we don't need to be using them.
Refs #88088