loadMany function #101
nick-potts
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd love a
::loadMany
method that could be called on a state to fetch a collection of events.I started messing about with the source code, and it seems it'd need to be implemented on the
State
class, as well as. theStoresEvents
andStoresSnapshots
contracts. I got an initial proof of concept working pretty quickly, the main goal is to reduce the massive waterfall that can happen when loading many different states at once.My use case is batch processing order updates. I receive them in batches of 250, and I'm trying to avoid pulling each one individually because it hits my database too hard.
If it is something worth doing, I don't mind contributing an initial PR.
With some very rough changes, you can see that batching the queries is possible:
Beta Was this translation helpful? Give feedback.
All reactions