Escape refresh job for already fresh cache
Add a should_refresh method to escape async refresh when the cache is already fresh. This can happen when the worker is slow and there are too many refresh jobs to process.
@stephrdev is there anything missing for this PR to be accepted?
@stephrdev is there anything missing for this PR to be accepted?
I think I totally missed that one. After looking at it again I think this could be merged if the feature is configurable. Don't want to break things that rely on refreshing "newer" values.
@stephrdev is there anything missing for this PR to be accepted?
I think I totally missed that one. After looking at it again I think this could be merged if the feature is configurable. Don't want to break things that rely on refreshing "newer" values.
I can make this feature configurable by introducing a setting called CACHEBACK_TASK_ESCAPE_ALREADY_FRESH. It would default to false to ensure backward compatibility.
@stephrdev is there anything missing for this PR to be accepted?
I think I totally missed that one. After looking at it again I think this could be merged if the feature is configurable. Don't want to break things that rely on refreshing "newer" values.
I can make this feature configurable by introducing a setting called
CACHEBACK_TASK_ESCAPE_ALREADY_FRESH. It would default tofalseto ensure backward compatibility.
Sound great, thanks! I thought about the setting name and would propose CACHEBACK_VALIDATE_JOB_REFRESH_NEEDED in addition to some explaining docs. 👍