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

[BREAKING] Resolve cached values after batch dispatch #222

Merged
merged 1 commit into from Nov 15, 2019

Conversation

leebyron
Copy link
Contributor

@leebyron leebyron commented Nov 14, 2019

This is an alternate of #113, however when built atop the new Batch abstraction introduced in #220 the implementation becomes much simpler.

This change is breaking since it results in timing differences when cached values are resolved which can affect whole program behavior. However hopefully this behavior change is for the better since it should result in better whole-program optimization.

Fixes #224
Closes #113
Fixes #97

@leebyron leebyron changed the base branch from batch-object to master November 15, 2019 01:32
@leebyron leebyron merged commit 06c403b into master Nov 15, 2019
@leebyron leebyron deleted the batched-cache branch November 15, 2019 01:42
(maxBatchSize === 0 ||
(existingBatch.keys.length < maxBatchSize &&
(!existingBatch.cacheHits ||
existingBatch.cacheHits.length < maxBatchSize)))
Copy link

@Sarcasm Sarcasm Nov 28, 2019

Choose a reason for hiding this comment

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

I'm curious.

According to the README:

maxBatchSize
Limits the number of items that get passed in to the batchLoadFn.

Since batchLoadFn isn't called for the cache hits, is there any reasons for cacheHits to use this limit?

If the maxBatchSize was an "output batch size", then I assume we would want the limit to be something like:

(keys.length + cacheHits.length) < maxBatchSize

Choose a reason for hiding this comment

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

I found the same issue when hitting the limit with cache hits, my batchLoadFn is always called with 1 key only.

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