-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix issue with scheduled queries #7111
base: master
Are you sure you want to change the base?
Conversation
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.
Tested this manually, seems to check out
0d863b8
to
f1b6be0
Compare
@arikfr Any idea if this will interact with the scheduled queries hash issue you were looking at yesterday? |
@@ -389,6 +389,8 @@ def groups(self): | |||
def should_schedule_next(previous_iteration, now, interval, time=None, day_of_week=None, failures=0): | |||
# if time exists then interval > 23 hours (82800s) | |||
# if day_of_week exists then interval > 6 days (518400s) | |||
if previous_iteration is None: | |||
return 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.
Why not return True here instead of the or not retrieved_at
in the calling function?
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.
I don't remember there being a specific reason. I think both ways are logically equivalent.
if all(value is None for value in query.schedule.values()): | ||
continue |
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's this 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.
It's been a little while since I looked at this, but I think this is the answer:
The only way to check whether a query doesn't have a refresh schedule is to ensure that everything in query.schedule.values()
is None. For example, interval, until, time are all keys in the query.schedule
. It's possible to have a query refresh schedule when just one of these keys is not None.
If a query doesn't have a refresh schedule, then we can just continue to the next query in the loop.
What type of PR is this?
Description
There's currently an issue in Redash where some queries fail to refresh on their schedule. This happens when the query has no
latest_query_data
, which makesretrieved_at = None
, which makes it so the query never gets added tooutdated_queries
. This PR fixes that.The problem can be reproduced by running the unit test that's part of this PR (without making the fix first, of course)
How is this tested?
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)