fix(recurring-task): reduce update load on task_processor_recurringtask
table (WIP)
#23
+187
−75
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.
This is a WIP / PoC for a hypothesis that we are seeing a high number of updates on the
task_processor_recurringtask
table due to the fact that anupdate_or_create
is called every time that a module is reloaded that includes a function decorated with@register_recurring_task()
.The general approach is to only update the recurring tasks when the processor starts instead. There's a chance that we could optimise this further and only do it on a deployment, but this should at least reduce the load significantly in environments that are running a lot of instances of the Flagsmith application which may also be getting terminated / instantiated regularly.