jobQuery return retries different from retry time cycle

im having some strange behavior with this job query in an execution listener Javascript at camunda 7.16:

execution.getProcessEngineServices().getManagementService().createJobQuery()
.activityId(execution.getCurrentActivityId())
.processInstanceId(execution.getProcessInstanceId())
.singleResult()
.getRetries();

even if my task is with Retry Time Cycle “R5/PT10S” or “R1/PT10S” the job query always returns 3 in the first try and decrement…

in my script im trying to throw a BpmnError when i get to retries 1, and this works for most cases… but if i set R1/PT10S it opens an incident… because the jobquery returns 3, but camunda opens an incident in the first try

1 Like

Just ran a quick test with your code and you are right. Keeps returning 3 always, no matter what I set in Retry Time Cycle.

.getRetries() always returns 3,
but,
.getPriority() correctly returns 2

Example attached.
Test-Get-Retries.bpmn (4.0 KB)

2 Likes

Hi,

This is a known issue: Job Executor get Retries() method always returns '3' the first time. · Issue #2300 · camunda/camunda-bpm-platform · GitHub

Cheers,
Thorben