• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sonus21 / rqueue / 2610

pending completion
2610

push

circleci

web-flow
Fixing #193. (#194)

* Fixing #193.

* added doc

* add a warning log for not running tasks

* wip

* Use hybrid combination of Redis and fixed rate scheduler to avoid job multiplications.

* test fixes

* 25% buffer

* doc updated.

* new user

---------

Co-authored-by: Sonu Kumar <sonu@git>

135 of 135 new or added lines in 5 files covered. (100.0%)

5378 of 5877 relevant lines covered (91.51%)

0.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/rqueue-core/src/main/java/com/github/sonus21/rqueue/config/RqueueSchedulerConfig.java
1
/*
2
 * Copyright (c) 2020-2023 Sonu Kumar
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * You may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and limitations under the License.
14
 *
15
 */
16

17
package com.github.sonus21.rqueue.config;
18

19
import com.github.sonus21.rqueue.utils.Constants;
20
import lombok.Getter;
21
import lombok.Setter;
22
import org.springframework.beans.factory.annotation.Value;
23
import org.springframework.context.annotation.Configuration;
24
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
25

26
@Configuration
27
@Getter
28
@Setter
29
public class RqueueSchedulerConfig {
1✔
30

31
  /**
32
   * Whether scheduling feature is enabled or not. This can be used to control different servers
33
   * where on a server only scheduler is running, while on other only workers are running.
34
   */
35
  @Value("${rqueue.scheduler.enabled:true}")
36
  private boolean enabled;
37

38
  /**
39
   * This is used to control whether same redis {@link RedisMessageListenerContainer} would be used
40
   * or new one should be created, this must be set to true when using two different connection for
41
   * Rqueue and application Redis.
42
   */
43
  @Value("${rqueue.scheduler.listener.shared:true}")
44
  private boolean listenerShared;
45

46
  /**
47
   * This is used to control message scheduler auto start feature, if it's disabled then messages
48
   * are moved only when a message is received from Redis PUB/SUB channel.
49
   */
50
  @Value("${rqueue.scheduler.auto.start:true}")
51
  private boolean autoStart;
52

53
  /**
54
   * This is used to control message scheduler redis pub/sub interaction, this can be used to
55
   * completely disable the redis PUB/SUB interaction
56
   */
57
  @Value("${rqueue.scheduler.redis.enabled:true}")
58
  private boolean redisEnabled;
59

60
  // Number of threads used to process scheduled-queue messages
61
  @Value("${rqueue.scheduler.scheduled.message.thread.pool.size:3}")
62
  private int scheduledMessageThreadPoolSize;
63

64
  //  Number of threads used to process processing-queue messages
65
  @Value("${rqueue.scheduler.processing.message.thread.pool.size:1}")
66
  private int processingMessageThreadPoolSize;
67

68
  // How frequently messages should be moved from scheduled queues to source queue
69
  @Value("${rqueue.scheduler.scheduled.message.time.interval:2000}")
70
  private long scheduledMessageTimeIntervalInMilli;
71

72
  // How long the application should wait for task termination
73
  @Value("${rqueue.scheduler.termination.wait.time:200}")
74
  private long terminationWaitTime;
75

76
  // Maximum delay for message mover task due to failure
77
  @Value("${rqueue.scheduler.max.message.mover.delay:60000}")
78
  private long maxMessageMoverDelay;
79

80
  // Minimum amount of time between two consecutive message move calls
81
  @Value("${rqueue.scheduler.min.message.mover.delay:100}")
82
  private long minMessageMoverDelay;
83

84
  // Maximum number of messages that should be copied from scheduled to normal queue
85
  @Value("${rqueue.scheduler.max.message.count:100}")
86
  private long maxMessageCount;
87

88
  public long minMessageMoveDelay() {
89
    if (minMessageMoverDelay <= 0) {
1✔
90
      return Constants.MIN_SCHEDULE_INTERVAL;
×
91
    }
92
    return minMessageMoverDelay;
1✔
93
  }
94
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc