-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement a windowed batch shcheduler #9
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I have also added another helper const batcher = batshit.create({
fetcher: async (ids: number[]) => {
return fetchAllUsersByIds(ids);
},
scheduler: maxBatchSizeScheduler({
maxBatchSize: 100,
}),
resolver: keyResolver("id"),
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should probably be added to the .gitignore file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good from my point of view
Fixes #6
Implement helper function
This example batcher will batch all fetch calls made within
10 ms
OR if the number of fetch calls(batch size) exceeds100
items.The behaviour of the scheduler could also be manually implemented since the
BatcherScheduler
function is now provided a third argument ofbatchSize: number
.Ref: