Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
configurable mail delay
Browse files Browse the repository at this point in the history
  • Loading branch information
dreske committed Mar 13, 2023
1 parent 1f873f0 commit 84e151e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.tsystems.mms.cwa.registration.cancellation.domain.JobEntryRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Pageable;

import java.time.LocalDateTime;
Expand All @@ -16,6 +17,9 @@ public class SenderThread {
private final CancellationsService cancellationsService;
private boolean running = true;

@Value("${email.delay}")
private int mailDelay;

public SenderThread(Job job, JobEntryRepository jobEntryRepository, CancellationsService cancellationsService) {
this.job = job;
this.jobEntryRepository = jobEntryRepository;
Expand Down Expand Up @@ -49,7 +53,7 @@ public void start() {
long stopTimestamp = System.currentTimeMillis();
// Hacky, but totally ok for now
try {
Thread.sleep(Math.max(0, 3000 - (stopTimestamp - startTimestamp)));
Thread.sleep(Math.max(0, mailDelay - (stopTimestamp - startTimestamp)));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 84e151e

Please sign in to comment.