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

Syncing optimization #33

Open
juanca opened this issue Jul 5, 2017 · 0 comments
Open

Syncing optimization #33

juanca opened this issue Jul 5, 2017 · 0 comments

Comments

@juanca
Copy link
Contributor

juanca commented Jul 5, 2017

I think there are some possible optimizations to avoid clobbering the store.

  1. Fetching event

The fetching flow emits a bunch of events in our store. The logged output looks similar to:

REQUEST_COLLECTION
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
ADD_MODEL
SYNC_COLLECTION
  1. ... Not sure about other code flows but I can see this being a problem throughout the backbone event system.

A few solutions off the top of my head:

  • Silence events when using the brainstem-redux API? This does not seem ideal since it seems to be side-stepping the issue
  • Stateful handling of events (e.g. do not handle events after REQUEST_COLLECTION until SYNC_COLLECTION). This might not work if there is a server error?
  • Throttle event handler. This only works if the event handler always does the same thing (regardless of event type) -- always syncs the data between storage manager and the store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant