screwdriver-queue-service 3.0.6 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-queue-service",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Screwdriver Queue Service API",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"directories": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"npm-auto-version": "^1.0.0",
|
|
29
29
|
"redlock": "^4.2.0",
|
|
30
30
|
"screwdriver-aws-producer-service": "^2.0.0",
|
|
31
|
-
"screwdriver-data-schema": "^
|
|
31
|
+
"screwdriver-data-schema": "^23.0.4",
|
|
32
32
|
"screwdriver-executor-docker": "^6.0.0",
|
|
33
33
|
"screwdriver-executor-jenkins": "^6.0.0",
|
|
34
34
|
"screwdriver-executor-k8s": "^15.0.0",
|
|
@@ -221,6 +221,9 @@ async function startPeriodic(executor, config) {
|
|
|
221
221
|
|
|
222
222
|
// Note: arguments to enqueueAt are [timestamp, queue name, job name, array of args]
|
|
223
223
|
let shouldRetry = false;
|
|
224
|
+
const nextDate = new Date(next);
|
|
225
|
+
|
|
226
|
+
logger.info(`Enqueued periodic job ${job.id} to be executed at ${nextDate}`);
|
|
224
227
|
|
|
225
228
|
try {
|
|
226
229
|
await executor.queue.enqueueAt(next, executor.periodicBuildQueue, 'startDelayed', [{ jobId: job.id }]);
|
|
@@ -229,9 +232,9 @@ async function startPeriodic(executor, config) {
|
|
|
229
232
|
// eslint-disable-next-line max-len
|
|
230
233
|
if (err && err.message !== 'Job already enqueued at this time with same arguments') {
|
|
231
234
|
shouldRetry = true;
|
|
232
|
-
logger.warn(`duplicate build: failed to enqueue for job ${job.id}: ${err}`);
|
|
233
|
-
} else {
|
|
234
235
|
logger.error(`failed to enqueue for job ${job.id}: ${err}`);
|
|
236
|
+
} else {
|
|
237
|
+
logger.warn(`duplicate build: failed to enqueue for job ${job.id}: ${err}`);
|
|
235
238
|
}
|
|
236
239
|
}
|
|
237
240
|
|
|
@@ -107,7 +107,15 @@ const transformCron = (cronExp, jobId) => {
|
|
|
107
107
|
* @return {Number} Epoch timestamp (time of next execution).
|
|
108
108
|
*/
|
|
109
109
|
const nextExecution = cronExp => {
|
|
110
|
-
|
|
110
|
+
// Scheduled jobs may run a little ahead of schedule.
|
|
111
|
+
// The next job to be executed is delayed so that it will be at the next timing even in that case.
|
|
112
|
+
const date = new Date();
|
|
113
|
+
|
|
114
|
+
date.setMinutes(date.getMinutes() + 5);
|
|
115
|
+
const options = {
|
|
116
|
+
currentDate: date
|
|
117
|
+
};
|
|
118
|
+
const interval = parseExpression(cronExp, options);
|
|
111
119
|
|
|
112
120
|
return interval.next().getTime();
|
|
113
121
|
};
|