@live-change/dao 0.3.9 → 0.3.10

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.
@@ -56,7 +56,7 @@ class LoopbackConnection extends Connection {
56
56
  }
57
57
 
58
58
  dispose() {
59
- this.finished = true
59
+ super.dispose()
60
60
  this.handleDisconnect()
61
61
  this.emit('close')
62
62
  }
@@ -123,6 +123,8 @@ class Connection extends EventEmitter {
123
123
  this.remoteObserveSent = new Map()
124
124
  this.remoteUnobserveSent = new Map()
125
125
 
126
+ this.activeTimeouts = new Set()
127
+
126
128
  this.autoReconnect = true
127
129
 
128
130
  this.finished = false
@@ -173,7 +175,8 @@ class Connection extends EventEmitter {
173
175
  }
174
176
 
175
177
  if (settings.requestTimeout && settings.requestTimeout < Infinity) {
176
- setTimeout(() => {
178
+ const timeout = setTimeout(() => {
179
+ this.activeTimeouts.delete(timeout)
177
180
  let waiting = this.waitingRequests.get(msg.requestId)
178
181
  if (waiting) {
179
182
  waiting.handler('timeout')
@@ -189,6 +192,7 @@ class Connection extends EventEmitter {
189
192
  }
190
193
  }
191
194
  }, settings.requestTimeout)
195
+ this.activeTimeouts.add(timeout)
192
196
  }
193
197
 
194
198
  if(this.connected) {
@@ -443,6 +447,12 @@ class Connection extends EventEmitter {
443
447
  })
444
448
  }
445
449
 
450
+ dispose() {
451
+ console.log("DISPOSE REACTIVE CONNECTION")
452
+ this.finished = true
453
+ for(const timeout of this.activeTimeouts) clearTimeout(timeout)
454
+ }
455
+
446
456
  }
447
457
 
448
458
  module.exports = Connection
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "scripts": {
37
37
  "test": "NODE_ENV=test blue-tape tests/*"
38
38
  },
39
- "version": "0.3.9"
39
+ "version": "0.3.10"
40
40
  }