Skip to content

Commit 6786191

Browse files
committed
Use cached MessageSweeper field in RqueueUtilityServiceImpl.makeEmpty
The constructor already resolves MessageSweeper.getInstance(...) into the messageSweeper field; makeEmpty was still calling the static getInstance on every invocation. Just call the cached instance. Pure cleanup — getInstance is a synchronized double-checked-lock singleton that returns the same instance the field already holds, so behaviour is unchanged. This lines makeEmpty up with how the rest of the class uses its injected dependencies. Assisted-By: Claude Code
1 parent e164cb0 commit 6786191

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

rqueue-redis/src/main/java/com/github/sonus21/rqueue/redis/web/RqueueUtilityServiceImpl.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,11 @@ public BooleanResponse makeEmpty(String queueName, String dataName) {
223223
if (type == null || type == org.springframework.data.redis.connection.DataType.NONE) {
224224
return new BooleanResponse(true);
225225
}
226-
return new BooleanResponse(
227-
MessageSweeper.getInstance(rqueueConfig, rqueueMessageTemplate, messageMetadataService)
228-
.deleteAllMessages(MessageDeleteRequest.builder()
229-
.dataName(dataName)
230-
.queueName(queueName)
231-
.dataType(type)
232-
.build()));
226+
return new BooleanResponse(messageSweeper.deleteAllMessages(MessageDeleteRequest.builder()
227+
.dataName(dataName)
228+
.queueName(queueName)
229+
.dataType(type)
230+
.build()));
233231
}
234232

235233
private boolean shouldFetchVersionDetail() {

0 commit comments

Comments
 (0)