fix(webhooks): default task processor to use processor and prevent webhook retries in non-processor environments #3273
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.
Changes
This PR does 2 things:
TASK_RUN_METHOD
setting such that the task processor should always default to using the task processor itself, for any asynchronous invocations inside the tasks themselves.How did you test this code?
In staging, we noticed that the changes made in this PR did not work as expected, since the tasks were run in a separate thread, not scheduled for the task processor. We will retest this behaviour in staging once this PR is merged.
Ran the processor locally and confirmed that the TASK_RUN_METHOD setting was correctly set to TASK_PROCESSOR when RUN_BY_PROCESSOR=True.
Ran the API locally and confirmed that the TASK_RUN_METHOD setting was correctly defaulted to SEPARATE_THREAD when RUN_BY_PROCESSOR=False
Added a unit test for testing new logic to prevent webhook retries.