Skip to content

Updater optimization #133

Open
Open
@dhilt

Description

@dhilt

Currently Workflow.fix({ updater }) runs through all the items in the Buffer. Could the procedure be optimized? There is a suggestion to convert updater into predicate function or provide breaking callback:

  // predicate
  this.datasource.adapter.fix({
    updater: ({ data }: { data: MyItem }) => {
      if (this.needToUpdate(data)) {
        this.updateItem(data);
        return true;
      }
    }
  });

  // callback
  this.datasource.adapter.fix({
    updater: ({ data }: { data: MyItem }, callback: Function) => {
      if (this.needToUpdate(data)) {
        this.updateItem(data);
        callback();
      }
    }
  });

Source: issue 121

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions