Skip to content
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

MapCache: Invalidating a key doesn't invalidate outstanding requests #492

Open
creisman opened this issue Mar 26, 2019 · 2 comments
Open
Labels

Comments

@creisman
Copy link
Contributor

creisman commented Mar 26, 2019

Repro:

map.get('test', ifAbsent: (k) => longLoad());
map.invalidate('test');
// longLoad() completes
expect(await map.get('test'), isNull);  // FAILS

Things to consider:
Should the original call to get() that passed ifAbsent return the value or null?

@yjbanov yjbanov added the bug label Apr 3, 2019
@cbracken
Copy link
Member

cbracken commented Nov 5, 2019

Should the original call to get() that passed ifAbsent return the value or null?

The two most obvious candidates would be the value or to complete with a Future.error. The latter doesn't offer particularly good ergonomics though. Given we don't have a mechanism to kill an async task in flight, I suspect the value is the right answer here.

Thanks for including repro steps.

@caiboyang-google
Copy link

caiboyang-google commented Oct 24, 2023

Have we considered the option of only removing the outstanding value without failing the existing thread?

If I have two threads, the first thread is obtaining the value from the RPC, and the second thread wants to invalidate all the cached values and reload the value from the current timestamp. The second thread cannot accomplish this by simply invalidating the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants