Skip to content

bpm: the Inbox listing still reads identity links and the process instance once per task - #7175 removed one of three per-task queries and called it one statement #7232

Description

@delchev

Summary

#7175 (#7141) moved the Inbox's subject variables onto the task query (findTasksWithProcessVariables + includeProcessVariables()), removing the one variable read per task. The new javadoc in BpmInboxEndpoint.mapToDTOs (lines 64-67) and in TaskServiceImpl.findTasks(type, boolean) (line 247) now claims the listing is "one statement". It is not: mapToDTO still runs two more queries per task.

components/engine/engine-bpm-flowable/src/main/java/org/eclipse/dirigible/components/engine/bpm/flowable/endpoint/BpmInboxEndpoint.java:

List<IdentityLink> identityLinks = bpmService.getTaskIdentityLinks(task.getId());                       // line 90
...
ProcessInstanceData processInstance = bpmService.getProcessInstanceById(task.getProcessInstanceId());   // line 107

getTaskIdentityLinks runs validateTask(taskId) + getIdentityLinksForTask (TaskServiceImpl.java:276-280, two statements); getProcessInstanceById runs a ProcessInstanceQuery (BpmService.java:320-323 -> BpmProviderFlowable.getProcessInstance). With the store polling ?type=assignee&limit=100 and ?type=groups every 30 s and on every route change, a 100-task inbox is still roughly 300 statements per poll - #7175 removed about a quarter of the #7141 problem and documented it as solved.

Fix

  • getProcessInstanceById is keyed by processInstanceId, which many tasks share: dedupe per listing with the same computeIfAbsent pattern labelKeys already uses (line 115), or ride it on the task query (includeProcessVariables already brings the instance's variables; the business key / definition id are on the task).
  • Identity links: Flowable's TaskQuery cannot include them, but IdentityLinkService/taskInvolvedUser filters or one HistoricIdentityLinkQuery over the listing's task ids replace 100 validate+query pairs with one statement.
  • Fix the two javadoc claims either way.

Found reviewing #7175.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions