Skip to content

Remove a unnecessary Thread.sleep() from ClusterCommandExecutor.collectResults() #2518

Closed
@dongmyo

Description

@dongmyo

https://github.com/spring-projects/spring-data-redis/blob/main/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java#L224

when for loop ends with all futures done or cancelled in ClusterCommandExecutor.collectResults().

https://github.com/spring-projects/spring-data-redis/blob/main/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java#L258

after that, there is no need for thread to be slept, but Thread.sleep() is called unnecessarily.

it could be better to check if the done is false.

try {
    if (!done) {
        Thread.sleep(10);
    }
} catch (InterruptedException e) {
    // ...   
}

Metadata

Metadata

Assignees

Labels

in: coreIssues in core supporttype: taskA general task

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions