From d532e9015618fadef9d707e9c508df4aed40dd47 Mon Sep 17 00:00:00 2001 From: khoa-nd Date: Fri, 30 Oct 2015 11:54:21 +0700 Subject: [PATCH 1/2] Scale the sleep time to 10 to 15 minutes --- src/main/java/com/techlooper/cron/JobAlertEmailSender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/techlooper/cron/JobAlertEmailSender.java b/src/main/java/com/techlooper/cron/JobAlertEmailSender.java index 68823850a..41f37eef3 100644 --- a/src/main/java/com/techlooper/cron/JobAlertEmailSender.java +++ b/src/main/java/com/techlooper/cron/JobAlertEmailSender.java @@ -55,6 +55,7 @@ public synchronized void sendJobAlertEmail() throws Exception { if (!jobAlertRegistrationEntities.isEmpty()) { int count = 0; + Thread.sleep(getRandomNumberInRange(600000, 900000)); for (JobAlertRegistrationEntity jobAlertRegistrationEntity : jobAlertRegistrationEntities) { if (StringUtils.isEmpty(jobAlertRegistrationEntity.getLastEmailSentDateTime())) { jobAlertRegistrationEntity.setLastEmailSentDateTime(yesterdayDate(BASIC_DATE_TIME_PATTERN)); @@ -63,7 +64,6 @@ public synchronized void sendJobAlertEmail() throws Exception { Date lastSentDate = string2Date(jobAlertRegistrationEntity.getLastEmailSentDateTime(), BASIC_DATE_TIME_PATTERN); Date currentDate = new Date(); - Thread.sleep(getRandomNumberInRange(1000, 5000)); if (daysBetween(lastSentDate, currentDate) > 0) { JobSearchCriteria criteria = dozerMapper.map(jobAlertRegistrationEntity, JobSearchCriteria.class); JobSearchResponse jobSearchResponse = jobAggregatorService.findJob(criteria); From 7b01990b288869d79711b273c5575c12986aed8e Mon Sep 17 00:00:00 2001 From: khoa-nd Date: Fri, 30 Oct 2015 11:56:39 +0700 Subject: [PATCH 2/2] Scale the sleep time to 10 to 15 minutes --- src/main/java/com/techlooper/cron/JobAlertEmailSender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/techlooper/cron/JobAlertEmailSender.java b/src/main/java/com/techlooper/cron/JobAlertEmailSender.java index 41f37eef3..917d05497 100644 --- a/src/main/java/com/techlooper/cron/JobAlertEmailSender.java +++ b/src/main/java/com/techlooper/cron/JobAlertEmailSender.java @@ -55,7 +55,7 @@ public synchronized void sendJobAlertEmail() throws Exception { if (!jobAlertRegistrationEntities.isEmpty()) { int count = 0; - Thread.sleep(getRandomNumberInRange(600000, 900000)); + Thread.sleep(getRandomNumberInRange(600000, 900000) + 600000); for (JobAlertRegistrationEntity jobAlertRegistrationEntity : jobAlertRegistrationEntities) { if (StringUtils.isEmpty(jobAlertRegistrationEntity.getLastEmailSentDateTime())) { jobAlertRegistrationEntity.setLastEmailSentDateTime(yesterdayDate(BASIC_DATE_TIME_PATTERN));