-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape refresh job for already fresh cache #95
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this option for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.