-
Notifications
You must be signed in to change notification settings - Fork 21
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
Flushing Redis DB causes trouble retrieving cached queries #636
Comments
Ouch. Yep. Obviously ideally one would avoid flushing redis, but clearly the state machine needs to reconcile itself with what’s actually in the cache as well. |
Yep, I agree. For now, I have update redis manually with:
|
Got to be a bit careful here, because if Redis were to be flushed while something transactional was going on, then the state of FlowDB may be misleading. I'd be inclined to say that this should be a manually triggered reconcile, because doing it on the fly with potentially multiple flowmachine instances is gonna be asking for race conditions. |
Describe the bug
After flushing the Redis DB, the retrieval of cached queries through
q.get_query()
causes a re-computation of the query, that is, a call toq._make_query()
instead of simply retrieving the cached table.This is a bug because while
q.is_stored
reports as if the query is stored, when the user attempts to fetch it one finds that the query is being re-calculated.The problem is basically caused because
get_query
uses redis to check whether the query has been completed, which will be False if the redis has been flushed:On the other hand,
is_stored
is simpler and only looks at whether the cache table exists:Product
Flowamchine
Version
master branch
To Reproduce
q = Query()
q.store()
q.redis.flush_db()
q.is_stored
q.get_query()
Expected behavior
Cached queries should not be recomputed unless the user explicit asks for it. Flushing redis should not mean that the user wants to reset the cache. Rather, the redis database should be updated accordingly.
The call to
get_query
should set theQueryStateMachine
to completed if the cache table exists.The text was updated successfully, but these errors were encountered: