Skip to content

This adds support for calling dispatch if the ValueCache takes timein get call #91

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

Closed
wants to merge 2 commits into from

Conversation

bbakerman
Copy link
Member

The ValueCache is an async affair. This means that the dataLoader.load() call can return and dispatch() maybe call and that key will be missed in the batch function.

This adds support to call dispatch if the valueCache.get() call does not complete immediately (the default noop one will complete immediately)

There is options to turn this behavior on and off - for example a ScheduledDataLoaderRegistry would be another technique to load missed batches periodically

#90

if (!cachedLookupCompletedImmediately && !loaderCF.isDone()) {
if (loaderOptions.getValueCacheOptions().isDispatchOnCacheMiss()) {
dispatch();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix - this will dispatch if the cache get miss took time to complete before we enqueued the batch loader call.

The danger here is that it interferes with other batch calls on this loader (premature batch calling) but the alternative is that it will hang.

This balances that out

The other alternative is that people use ScheduledDataLoaderRegistry to periodically tick and dispatch on schedule

@bbakerman
Copy link
Member Author

This is not how we should fix the problem on reflection

@bbakerman bbakerman closed this Aug 8, 2021
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.

1 participant