Escape refresh job for already fresh cache#95
Escape refresh job for already fresh cache#95walison17 wants to merge 1 commit intocodeinthehole:masterfrom
Conversation
987d6e8 to
eabb15d
Compare
| @mock.patch('tests.test_base_job.EmptyDummyJob.fetch', return_value='foo') | ||
| def test_escape_job_refresh(self, fetch_mock, rq_burst): | ||
| job = EmptyDummyJob() | ||
| job.task_options = {'is_async': False} |
There was a problem hiding this comment.
What is this option for?
There was a problem hiding this comment.
by default (is_async = True) jobs will be consumed in different threads and call_count don't work properly with many threads
|
@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 |
Sound great, thanks! I thought about the setting name and would propose |
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.