Skip to content

Commit

Permalink
Put property value in QuartzProperties, update docker file to handle …
Browse files Browse the repository at this point in the history
…replicas for api & worker nodes
  • Loading branch information
maallen committed Aug 16, 2023
1 parent d6cfa3c commit c32d863
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
34 changes: 17 additions & 17 deletions docker/docker-compose-api-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ services:
worker:
deploy:
mode: replicated
replicas: 1
replicas: 2
endpoint_mode: vip
# resources:
# limits:
# cpus: '0.50'
# memory: 500M
# reservations:
# cpus: '0.25'
# memory: 20M
resources:
limits:
cpus: '2'
memory: 1G
reservations:
cpus: '1'
memory: 200M
healthcheck:
test: [ "CMD", "curl", "localhost:8080/" ]
interval: 5s
Expand Down Expand Up @@ -76,15 +76,15 @@ services:
api:
deploy:
mode: replicated
replicas: 1
replicas: 2
endpoint_mode: vip
# resources:
# limits:
# cpus: '0.50'
# memory: 500M
# reservations:
# cpus: '0.25'
# memory: 20M
resources:
limits:
cpus: '2'
memory: 1G
reservations:
cpus: '1'
memory: 200M
healthcheck:
test: [ "CMD", "curl", "localhost:8080/" ]
interval: 5s
Expand All @@ -99,7 +99,7 @@ services:
links:
- db
ports:
- "8080:8080"
- "8080-8081:8080"
restart: always
environment:
SPRING_APPLICATION_JSON: '{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import javax.annotation.PostConstruct;
import org.quartz.JobDetail;
Expand All @@ -15,7 +16,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
Expand All @@ -33,8 +33,7 @@ public class QuartzConfig {
@Autowired(required = false)
List<JobDetail> jobDetails = new ArrayList<>();

@Value("${l10n.org.quartz.scheduler.enabled:true}")
boolean startScheduler;
@Autowired QuartzPropertiesConfig quartzPropertiesConfig;

/**
* Starts the scheduler after having removed outdated trigger/jobs
Expand All @@ -43,8 +42,9 @@ public class QuartzConfig {
*/
@PostConstruct
void startScheduler() throws SchedulerException {
Properties quartzProps = quartzPropertiesConfig.getQuartzProperties();
removeOutdatedJobs();
if (startScheduler) {
if (Boolean.parseBoolean(quartzProps.getProperty("org.quartz.scheduler.enabled", "true"))) {
logger.info("Starting scheduler");
scheduler.startDelayed(2);
}
Expand Down

0 comments on commit c32d863

Please sign in to comment.