Skip to content

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

Merged
merged 4 commits into from
Apr 3, 2025

Conversation

markstory
Copy link
Member

@markstory markstory commented Apr 1, 2025

Remove usage of these celery features where we don't need to be using them.

Refs #88088

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
@markstory markstory requested review from a team as code owners April 1, 2025 19:35
@markstory markstory requested a review from a team April 1, 2025 19:35
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 1, 2025
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All 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.
Comment on lines +1170 to +1176
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(
Copy link
Member Author

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.

Copy link
Member

@evanh evanh left a 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.

@markstory markstory merged commit b85814a into master Apr 3, 2025
48 checks passed
@markstory markstory deleted the ref-task-signature branch April 3, 2025 15:00
adrian-codecov pushed a commit that referenced this pull request Apr 3, 2025
Remove usage of these celery features where we don't need to be using
them.

Refs #88088
andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
Remove usage of these celery features where we don't need to be using
them.

Refs #88088
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants