Skip to content

Commit e164cb0

Browse files
committed
Drop redundant @conditional from RqueueUtilityServiceImpl
The module-level @conditional(RedisBackendCondition) on RqueueRedisListenerConfig plus its @componentscan of com.github.sonus21.rqueue.redis already gates this bean to the Redis backend. The per-class annotation was redundant. Assisted-By: Claude Code
1 parent 848e23d commit e164cb0

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.github.sonus21.rqueue.utils.HttpUtils.readUrl;
2020

21-
import com.github.sonus21.rqueue.config.RedisBackendCondition;
2221
import com.github.sonus21.rqueue.config.RqueueConfig;
2322
import com.github.sonus21.rqueue.config.RqueueWebConfig;
2423
import com.github.sonus21.rqueue.core.RqueueInternalPubSubChannel;
@@ -53,11 +52,15 @@
5352
import java.util.Map;
5453
import lombok.extern.slf4j.Slf4j;
5554
import org.springframework.beans.factory.annotation.Autowired;
56-
import org.springframework.context.annotation.Conditional;
5755
import org.springframework.stereotype.Service;
5856
import reactor.core.publisher.Mono;
5957

60-
@Conditional(RedisBackendCondition.class)
58+
/**
59+
* Redis-shaped impl. Backend gating is handled at module level via
60+
* {@code RqueueRedisListenerConfig.@Conditional(RedisBackendCondition)} + its
61+
* {@code @ComponentScan} of {@code com.github.sonus21.rqueue.redis} — a per-class
62+
* {@code @Conditional} would be redundant.
63+
*/
6164
@Service
6265
@Slf4j
6366
public class RqueueUtilityServiceImpl implements RqueueUtilityService {
@@ -69,6 +72,13 @@ public class RqueueUtilityServiceImpl implements RqueueUtilityService {
6972
private final RqueueMessageMetadataService messageMetadataService;
7073
private final RqueueInternalPubSubChannel rqueueInternalPubSubChannel;
7174
private final RqueueConfig rqueueConfig;
75+
/**
76+
* Resolved once via {@link MessageSweeper#getInstance} at construction so {@link #makeEmpty}
77+
* doesn't take the static-singleton path on every call. {@code getInstance} is itself a
78+
* (Redis-shaped) singleton so this just pins it to a field for direct reuse.
79+
*/
80+
private final MessageSweeper messageSweeper;
81+
7282
private String latestVersion = "NA";
7383
private String releaseLink = "#";
7484
private long versionFetchTime = 0;
@@ -89,6 +99,8 @@ public RqueueUtilityServiceImpl(
8999
this.rqueueMessageTemplate = rqueueMessageTemplate;
90100
this.messageMetadataService = messageMetadataService;
91101
this.rqueueInternalPubSubChannel = rqueueInternalPubSubChannel;
102+
this.messageSweeper =
103+
MessageSweeper.getInstance(rqueueConfig, rqueueMessageTemplate, messageMetadataService);
92104
}
93105

94106
@Override

0 commit comments

Comments
 (0)