Skip to content

Don't enqueue an async request when there's one already active #1378

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

Merged
merged 1 commit into from
Apr 26, 2019

Conversation

gnosek
Copy link
Contributor

@gnosek gnosek commented Apr 26, 2019

If an async lookup is in progress, the lookup key is already removed
from m_request_set but it's still present in m_value_map, so a subsequent
call to lookup() with the same key will do the same lookup again.

Also, when the request had a callback set, upon success we will remove
the value from m_value_map, including the callback, so the duplicate
lookup will store the result in m_value_map without calling the callback
again.

This patch ensures that there's always at most one in flight request
for a particular key.

@gnosek gnosek requested a review from adalton April 26, 2019 17:15
If an async lookup is in progress, the lookup key is already removed
from m_request_set but it's still present in m_value_map, so a subsequent
call to lookup() with the same key will do the same lookup again.

Also, when the request had a callback set, upon success we will remove
the value from m_value_map, _including the callback_, so the duplicate
lookup will store the result in m_value_map without calling the callback
again.

This patch ensures that there's always at most one in flight request
for a particular key.
@gnosek gnosek force-pushed the async-duplicate-requests branch from 99389ab to f27a1e2 Compare April 26, 2019 17:40
@gnosek gnosek merged commit cd6ee7d into dev Apr 26, 2019
@gnosek gnosek deleted the async-duplicate-requests branch April 26, 2019 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants