Skip to content

Commit d102746

Browse files
jannoteelemGitHub Enterprise
authored andcommitted
FRIDGE-1295 Stop reconnecting after Worker.disconnect has been called. (#425)
1 parent 767ccb1 commit d102746

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
2.0.10
1+
2.0.11
22
==========
33
Bug fixes
44
----------
5-
- Made options for `setWorkerActivity` nullable
5+
- Stop reconnecting after `Worker.disconnect` has been called.
6+
67

8+
2.0.10
9+
==========
10+
Bug fixes
11+
----------
12+
- Made the `options` parameter in `setWorkerActivity` optional
713

814

915
2.0.9

lib/signaling/EventBridgeSignaling.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,12 @@ export default class EventBridgeSignaling extends EventEmitter {
314314
const time = this.generateBackOffInterval(this.numAttempts);
315315

316316
setTimeout(() => {
317-
this.numAttempts++;
318-
this.createWebSocket();
317+
if (this.reconnect) {
318+
this.numAttempts++;
319+
this.createWebSocket();
320+
} else {
321+
this._log.info('Not reconnecting anymore, because the reconnect flag is false');
322+
}
319323
}, time);
320324
}
321325

@@ -352,6 +356,8 @@ export default class EventBridgeSignaling extends EventEmitter {
352356
disconnect() {
353357
this._log.info('Disconnecting websocket');
354358

359+
this.reconnect = false;
360+
355361
if (this.webSocket !== null) {
356362
['onmessage', 'onclose', 'onopen', 'onerror'].forEach(evt => {
357363
this.webSocket[evt] = null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"url": "https://github.com/twilio/twilio-taskrouter.js.git"
5757
},
5858
"dependencies": {
59-
"axios": "^1.6.7",
59+
"axios": "^1.7.4",
6060
"events": "3.3.0",
6161
"jwt-decode": "^3.1.2",
6262
"lodash": "^4.17.21",

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,12 +1848,12 @@ axios@^0.26.1:
18481848
dependencies:
18491849
follow-redirects "^1.14.8"
18501850

1851-
axios@^1.6.7:
1852-
version "1.6.7"
1853-
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7"
1854-
integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==
1851+
axios@^1.7.4:
1852+
version "1.7.4"
1853+
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.4.tgz#4c8ded1b43683c8dd362973c393f3ede24052aa2"
1854+
integrity sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==
18551855
dependencies:
1856-
follow-redirects "^1.15.4"
1856+
follow-redirects "^1.15.6"
18571857
form-data "^4.0.0"
18581858
proxy-from-env "^1.1.0"
18591859

@@ -2948,10 +2948,10 @@ follow-redirects@^1.14.8:
29482948
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
29492949
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
29502950

2951-
follow-redirects@^1.15.4:
2952-
version "1.15.5"
2953-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
2954-
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==
2951+
follow-redirects@^1.15.6:
2952+
version "1.15.6"
2953+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
2954+
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
29552955

29562956
for-each@^0.3.3:
29572957
version "0.3.3"

0 commit comments

Comments
 (0)