qdone 2.0.40-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,9 +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
- dedupContent = dedupContent.slice(0, max - sep.length - 42) + '...sha1:{' + (0, crypto_1.createHash)('sha1').update(dedupContent).digest('hex') + '}';
29
- 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;
30
32
  }
31
33
  exports.getDeduplicationId = getDeduplicationId;
32
34
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.40-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,9 +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
- dedupContent = dedupContent.slice(0, max - sep.length - 42) + '...sha1:{' + createHash('sha1').update(dedupContent).digest('hex') + '}'
24
- 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
25
27
  }
26
28
 
27
29
  /**