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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-queue-service",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "description": "Screwdriver Queue Service API",
5
5
  "main": "app.js",
6
6
  "directories": {
@@ -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
  };