Skip to content

Update the multiSet to update subscribers in a more optimized way #313

Description

@yuwenmemon

Problem

Currently, the way multiset works is that it notifies subscribers of any changes to the onyx keys in a loop:

_.each(data, (val, key) => {
// Update cache and optimistically inform subscribers on the next tick
cache.set(key, val);
notifySubscribersOnNextTick(key, val);
});
return Storage.multiSet(keyValuePairs)
.catch(error => evictStorageAndRetry(error, multiSet, data));

The performance of this can be improved in relation to collections, where we can see if all the keys are part of a collection, and if so - use keysChanged to update subscribers in a more optimized way.

Solution

Either:

  1. Update multiset to support the above, or
  2. Create a setCollection that is optimized for collections

cc @marcaaron

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions