Hello team,
I am facing unexpected issue I have a maker user task which hit complete button to move task to a checker user task, if the environment got 403 for any reason the UI tell to retry which force user to hit it maybe twice or three times, checking the task list for checker I found 3 duplicated instances instantiated from nowhere, also variables sent while complete task with variables got duplicated 3 TIMES!!
It doesn’t make sense to such concurrency issue to be happed,
my expectation is:
- even to overwrite the variable value not to make 3 identical variables.
- if one of the tasks got completed it should throw no task id found to complete again.
- I use the application Id from a variable to know the task id to be complete in this case even if we got the new task id to be completed would through exception as it is waiting for gateway expression to be passed.
here is the code snippet:-
val tasks = taskService.createTaskQuery().orderByTaskCreateTime().asc().list()
tasks.find {
getTaskVariable(it.id, BackofficeApplicationVariables.APPLICATION_ID).toString() == applicationId
}?.let {
if (it.assignee == SecurityUtil.getUsernameFromToken()) {
taskService.complete(it.id, variables)
}