Skip to content

Commit

Permalink
Fix possible deadlock in dynamic maxRetry resolution [ci fast] (#5474)
Browse files Browse the repository at this point in the history

Signed-off-by: jorgee <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
jorgee and pditommaso authored Nov 21, 2024
1 parent 6f52755 commit 25bbb62
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ class TaskConfig extends LazyMap implements Cloneable {

int getMaxRetries() {
def result = get('maxRetries')
def defResult = getErrorStrategy() == ErrorStrategy.RETRY ? 1 : 0
result ? result as int : defResult
result ? result as int : 1
}

int getMaxErrors() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class ProcessConfig implements Map<String,Object>, Cloneable {
debug: false,
cacheable: true,
shell: BashWrapperBuilder.BASH,
maxRetries: 0,
maxRetries: 1,
maxErrors: -1,
errorStrategy: ErrorStrategy.TERMINATE
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class TaskConfigTest extends Specification {

where:
value | expected
null | 0
0 | 0
null | 1
0 | 1
1 | 1
'3' | 3
10 | 10
Expand All @@ -171,8 +171,8 @@ class TaskConfigTest extends Specification {
when:
config = new TaskConfig()
then:
config.maxRetries == 0
config.getMaxRetries() == 0
config.maxRetries == 1
config.getMaxRetries() == 1
config.getErrorStrategy() == ErrorStrategy.TERMINATE

when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProcessConfigTest extends Specification {
expect:
config.shell == ['/bin/bash','-ue']
config.cacheable
config.maxRetries == 0
config.maxRetries == 1
config.maxErrors == -1
config.errorStrategy == ErrorStrategy.TERMINATE
}
Expand Down

0 comments on commit 25bbb62

Please sign in to comment.