qdone 2.0.39-alpha → 2.0.41-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.
@@ -24,11 +24,11 @@ function getDeduplicationId(dedupContent, opt) {
24
24
  // Don't transmit long keys to redis
25
25
  dedupContent = dedupContent.trim().replace(/[^a-zA-Z0-9!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/g, '_');
26
26
  const max = 128;
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
- }
31
- return dedupContent;
27
+ const sep = 'sha1::body:';
28
+ const hash = (0, crypto_1.createHash)('sha1').update(dedupContent).digest('hex');
29
+ const truncated = dedupContent.slice(0, max - sep.length - 42);
30
+ const id = `sha1:{${hash}}:body:${truncated}`;
31
+ return id;
32
32
  }
33
33
  exports.getDeduplicationId = getDeduplicationId;
34
34
  /**
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.39-alpha",
3
+ "version": "2.0.41-alpha",
4
4
  "description": "A distributed scheduler for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/dedup.js CHANGED
@@ -19,11 +19,11 @@ export function getDeduplicationId (dedupContent, opt) {
19
19
  // Don't transmit long keys to redis
20
20
  dedupContent = dedupContent.trim().replace(/[^a-zA-Z0-9!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/g, '_')
21
21
  const max = 128
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
- }
26
- return dedupContent
22
+ const sep = 'sha1::body:'
23
+ const hash = createHash('sha1').update(dedupContent).digest('hex')
24
+ const truncated = dedupContent.slice(0, max - sep.length - 42)
25
+ const id = `sha1:{${hash}}:body:${truncated}`
26
+ return id
27
27
  }
28
28
 
29
29
  /**
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
  }