Skip to content

Optimize lookup.js subscribe/unsubscribe functions

Andrii Bezuglyi requested to merge fix/lookup_load into master

The problems was with lines:

      if (subscription.pendingPromise) {
        await subscription.pendingPromise
        return
      }

If additional partitions subscribed, they were not loaded, because loading was already in progress and here we just await it and return, while we need to do one more loading.

Improvement idea is the following:

  • collect subscribes with attrs/partitions and use debounced version of load, so that load not start immediately, and other controls (other tables, for example) on the same page have change to do their subscribes before the actual load
  • if, nevertheless, during load more subscribes happen, do load in a loop, with condition checking if more pending partitions/attrs to load

The bug was always there, but only partitioned lookups revealed it - before that most of subscribes went to the same attributes, that is why we did not have situation, when during loading a subcribe with additional attrs requested.

Edited by Andrii Bezuglyi

Merge request reports