django-cacheback icon indicating copy to clipboard operation
django-cacheback copied to clipboard

Escape refresh job for already fresh cache

Open walison17 opened this issue 4 years ago • 4 comments

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.

walison17 avatar Oct 25 '21 12:10 walison17

@stephrdev is there anything missing for this PR to be accepted?

avelino avatar Jan 13 '25 18:01 avelino

@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 avatar Jan 14 '25 14:01 stephrdev

@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.

walison17 avatar Jan 20 '25 12:01 walison17

@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.

Sound great, thanks! I thought about the setting name and would propose CACHEBACK_VALIDATE_JOB_REFRESH_NEEDED in addition to some explaining docs. 👍

stephrdev avatar Jan 26 '25 10:01 stephrdev