qdone 2.0.38-alpha → 2.0.40-alpha

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.
@@ -25,9 +25,7 @@ function getDeduplicationId(dedupContent, opt) {
25
25
  dedupContent = dedupContent.trim().replace(/[^a-zA-Z0-9!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/g, '_');
26
26
  const max = 128;
27
27
  const sep = '...sha1:';
28
- if (dedupContent.length > max) {
29
- dedupContent = dedupContent.slice(0, max - sep.length - 40) + '...sha1:' + (0, crypto_1.createHash)('sha1').update(dedupContent).digest('hex');
30
- }
28
+ dedupContent = dedupContent.slice(0, max - sep.length - 42) + '...sha1:{' + (0, crypto_1.createHash)('sha1').update(dedupContent).digest('hex') + '}';
31
29
  return dedupContent;
32
30
  }
33
31
  exports.getDeduplicationId = getDeduplicationId;
@@ -278,7 +278,7 @@ async function sendMessageBatch(qrl, messages, opt) {
278
278
  const results = await Promise.all(promises);
279
279
  params.Entries = results.filter(({ shouldEnqueue }) => shouldEnqueue).map(({ m }) => m);
280
280
  if (!params.Entries.length)
281
- return;
281
+ return { Failed: [], Successful: [] };
282
282
  }
283
283
  // Send them
284
284
  const client = (0, sqs_js_1.getSQSClient)();
@@ -53,7 +53,7 @@ async function _cheapIdleCheck(qname, qrl, opt) {
53
53
  catch (e) {
54
54
  if (e instanceof client_sqs_1.QueueDoesNotExist) {
55
55
  // Count deleted queues as idle
56
- return { idle: true, SQS: 1 };
56
+ return { result: { idle: true }, SQS: 1 };
57
57
  }
58
58
  else {
59
59
  throw e;
@@ -217,7 +217,7 @@ class JobExecutor {
217
217
  console.log(JSON.stringify({ event: 'DELETE_MESSAGES', timestamp: start, count, qrl }));
218
218
  }
219
219
  // Mark batch as processed for dedup
220
- await Promise.all(result.Successful.map(e => (0, dedup_js_1.dedupSuccessfullyProcessed)(this.jobsByMessageId[e.Id], this.opt)));
220
+ await Promise.all(result.Successful.map(e => (0, dedup_js_1.dedupSuccessfullyProcessed)(this.jobsByMessageId[e.Id].message, this.opt)));
221
221
  }
222
222
  debug('DeleteMessageBatch returned', result);
223
223
  // TODO Sentry
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.38-alpha",
3
+ "version": "2.0.40-alpha",
4
4
  "description": "A distributed scheduler for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/dedup.js CHANGED
@@ -20,9 +20,7 @@ export function getDeduplicationId (dedupContent, opt) {
20
20
  dedupContent = dedupContent.trim().replace(/[^a-zA-Z0-9!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/g, '_')
21
21
  const max = 128
22
22
  const sep = '...sha1:'
23
- if (dedupContent.length > max) {
24
- dedupContent = dedupContent.slice(0, max - sep.length - 40) + '...sha1:' + createHash('sha1').update(dedupContent).digest('hex')
25
- }
23
+ dedupContent = dedupContent.slice(0, max - sep.length - 42) + '...sha1:{' + createHash('sha1').update(dedupContent).digest('hex') + '}'
26
24
  return dedupContent
27
25
  }
28
26
 
package/src/enqueue.js CHANGED
@@ -276,7 +276,7 @@ export async function sendMessageBatch (qrl, messages, opt) {
276
276
  const promises = params.Entries.map(async m => ({ m, shouldEnqueue: await dedupShouldEnqueue(m, opt) }))
277
277
  const results = await Promise.all(promises)
278
278
  params.Entries = results.filter(({ shouldEnqueue }) => shouldEnqueue).map(({ m }) => m)
279
- if (!params.Entries.length) return
279
+ if (!params.Entries.length) return { Failed: [], Successful: [] }
280
280
  }
281
281
 
282
282
  // Send them
package/src/idleQueues.js CHANGED
@@ -50,7 +50,7 @@ export async function _cheapIdleCheck (qname, qrl, opt) {
50
50
  } catch (e) {
51
51
  if (e instanceof QueueDoesNotExist) {
52
52
  // Count deleted queues as idle
53
- return { idle: true, SQS: 1 }
53
+ return { result: { idle: true }, SQS: 1 }
54
54
  } else {
55
55
  throw e
56
56
  }
@@ -224,7 +224,7 @@ export class JobExecutor {
224
224
  // Mark batch as processed for dedup
225
225
  await Promise.all(
226
226
  result.Successful.map(
227
- e => dedupSuccessfullyProcessed(this.jobsByMessageId[e.Id], this.opt)
227
+ e => dedupSuccessfullyProcessed(this.jobsByMessageId[e.Id].message, this.opt)
228
228
  )
229
229
  )
230
230
  }