screwdriver-queue-service 2.0.16 → 2.0.17
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/lib/queue.js +1 -0
- package/package.json +1 -1
- package/plugins/queue/put.js +3 -0
- package/plugins/queue/scheduler.js +20 -1
package/lib/queue.js
CHANGED
|
@@ -35,6 +35,7 @@ module.exports = class ExecutorQueue {
|
|
|
35
35
|
this.timeoutQueue = `${this.prefix}timeoutConfigs`;
|
|
36
36
|
this.cacheQueue = `${this.prefix}cache`;
|
|
37
37
|
this.unzipQueue = `${this.prefix}unzip`;
|
|
38
|
+
this.webhookQueue = `${this.prefix}webhooks`;
|
|
38
39
|
|
|
39
40
|
const redisConnection = { ...config.redisConnection, pkg: 'ioredis' };
|
|
40
41
|
|
package/package.json
CHANGED
package/plugins/queue/put.js
CHANGED
|
@@ -36,6 +36,9 @@ module.exports = () => ({
|
|
|
36
36
|
case 'unzip':
|
|
37
37
|
await scheduler.unzipArtifacts(executor, request.payload);
|
|
38
38
|
break;
|
|
39
|
+
case 'webhook':
|
|
40
|
+
await scheduler.queueWebhook(executor, request.payload);
|
|
41
|
+
break;
|
|
39
42
|
default:
|
|
40
43
|
await scheduler.start(executor, request.payload);
|
|
41
44
|
break;
|
|
@@ -716,6 +716,24 @@ async function unzipArtifacts(executor, config) {
|
|
|
716
716
|
return enq;
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
+
/**
|
|
720
|
+
* Pushes webhooks to redis
|
|
721
|
+
* @async queueWebhook
|
|
722
|
+
* @param {Object} executor
|
|
723
|
+
* @param {Object} webhookConfig
|
|
724
|
+
* @return {Promise}
|
|
725
|
+
*/
|
|
726
|
+
async function queueWebhook(executor, webhookConfig) {
|
|
727
|
+
await executor.connect();
|
|
728
|
+
|
|
729
|
+
return executor.queueBreaker.runCommand(
|
|
730
|
+
'enqueue',
|
|
731
|
+
executor.webhookQueue,
|
|
732
|
+
'sendWebhook',
|
|
733
|
+
JSON.stringify(webhookConfig)
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
|
|
719
737
|
module.exports = {
|
|
720
738
|
init,
|
|
721
739
|
start,
|
|
@@ -728,5 +746,6 @@ module.exports = {
|
|
|
728
746
|
stopTimer,
|
|
729
747
|
cleanUp,
|
|
730
748
|
clearCache,
|
|
731
|
-
unzipArtifacts
|
|
749
|
+
unzipArtifacts,
|
|
750
|
+
queueWebhook
|
|
732
751
|
};
|