UserOfficeProject / issue-tracker

Shared place for features and bugs from all collaborators.
0 stars 0 forks source link

Calls to getProposalWorkflow are slow #1235

Closed mutambaraf closed 1 day ago

mutambaraf commented 1 week ago

What is the problem and why is it a problem

Some of the calls to getProposalWorkflow are slow which will affect the performance of the system this can be shown with the grapgh below. This is mainly due to slowness when resolving proposalWorkflowConnectionGroups which does some computation in this function as shown.

groupProposalWorkflowConnectionsByDroppableArea(
    proposalWorkflowConnections: ProposalWorkflowConnection[]
  ) {
    const groupedProposalWorkflowConnections = this.getUniqueDroppableGroupIds(
      proposalWorkflowConnections
    ).map((item) => ({
      groupId: item.droppableGroupId,
      parentGroupId:
        proposalWorkflowConnections.find(
          (element) => element.proposalStatusId === item.prevProposalStatusId
        )?.droppableGroupId || null,
      connections: proposalWorkflowConnections.filter(
        (proposalWorkflowConnection) =>
          proposalWorkflowConnection.droppableGroupId === item.droppableGroupId
      ),
    }));

    return groupedProposalWorkflowConnections;
  }

Steps to reproduce (if it's a bug).

image

ACLay commented 6 days ago

Is this really a slow call? The trace in the screenshot only took 3 milliseconds.

mutambaraf commented 1 day ago

We are closing this for now then open in case we have degradation.