Skip to content

Commit baccd1e

Browse files
committed
feat: default multi-lock extend timeout
BREAKING CHANGE: contains multiple dependencies that had major version updated. Supports node >= 12.15.0
1 parent 0e049ab commit baccd1e

File tree

7 files changed

+2461
-1804
lines changed

7 files changed

+2461
-1804
lines changed

.mdeprc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
2-
"node": "10.16.3",
2+
"node": "12",
33
"nycCoverage": false,
44
"test_framework": "jest --coverage --coverageDirectory <coverageDirectory>",
55
"tests": "__tests__/*.js",
6-
"docker_compose": "__tests__/docker-compose.yml"
6+
"docker_compose": "__tests__/docker-compose.yml",
7+
"auto_compose": true,
8+
"services": [
9+
"redisSentinel"
10+
]
711
}

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"branch": "master",
2+
"branches": ["master"],
33
"verifyConditions": ["@semantic-release/npm", "@semantic-release/github"],
44
"analyzeCommits": {
55
"preset": "angular",

__tests__/docker-compose.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

__tests__/integration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('integration tests', () => {
99
jest.setTimeout(10000);
1010

1111
function QueueManager() {
12-
this.redis = new Redis({ host: 'redis', lazyConnect: true });
12+
this.redis = new Redis({ sentinels: [{ host: 'redis-sentinel', port: 26379 }], name: 'mservice', lazyConnect: true });
1313
this.pubsub = this.redis.duplicate();
1414
return Promise
1515
.join(this.redis.connect(), this.pubsub.connect())

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@
4141
"denque": "^1.4.1",
4242
"ioredis-lock": "^4.0.0",
4343
"lodash": "^4.17.15",
44-
"serialize-error": "^5.0.0"
44+
"serialize-error": "^7.0.1"
4545
},
4646
"devDependencies": {
47-
"@babel/cli": "^7.7.4",
48-
"@babel/core": "^7.7.4",
49-
"@babel/plugin-transform-strict-mode": "^7.7.4",
50-
"@makeomatic/deploy": "^9.5.0",
51-
"codecov": "^3.6.1",
52-
"cross-env": "^6.0.3",
53-
"eslint": "^6.7.1",
54-
"eslint-config-makeomatic": "^4.0.0",
55-
"eslint-plugin-import": "^2.18.2",
47+
"@babel/cli": "^7.10.1",
48+
"@babel/core": "^7.10.2",
49+
"@babel/plugin-transform-strict-mode": "^7.10.1",
50+
"@makeomatic/deploy": "^10.2.1",
51+
"codecov": "^3.7.0",
52+
"cross-env": "^7.0.2",
53+
"eslint": "^7.1.0",
54+
"eslint-config-makeomatic": "^5.0.0",
55+
"eslint-plugin-import": "^2.20.2",
5656
"eslint-plugin-promise": "^4.2.1",
57-
"eslint-plugin-unicorn": "^13.0.0",
58-
"ioredis": "^4.14.1",
59-
"jest": "^24.9.0",
60-
"sinon": "^7.5.0"
57+
"eslint-plugin-unicorn": "^20.1.0",
58+
"ioredis": "^4.17.3",
59+
"jest": "^26.0.1",
60+
"sinon": "^9.0.2"
6161
},
6262
"engine": {
63-
"node": ">= 10.15.0"
63+
"node": ">= 12.15.0"
6464
},
6565
"jest": {
6666
"testEnvironment": "node",

src/multi-lock.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class MultiLock {
1313
failed: [],
1414
};
1515

16-
locks.forEach((lock) => {
16+
for (const lock of locks.values()) {
1717
if (lock.isRejected()) {
1818
accumulator.failed.push(lock.reason());
1919
} else {
2020
accumulator.vault.push(lock.value());
2121
}
22-
});
22+
}
2323

2424
// throw aggregate error if we have failed
2525
if (accumulator.failed.length > 0) {
@@ -46,7 +46,7 @@ class MultiLock {
4646
}
4747

4848
// if extend fails we cleanup remaining locks
49-
extend(time) {
49+
extend(time = 10000) {
5050
assert(time > 0, '`time` must be greater than 0');
5151

5252
return Promise

0 commit comments

Comments
 (0)