mirror of https://github.com/rails/rails
Simplify `this.isActive() && this.webSocket` into `this.isActive()`
in Connection#close. We can do this because `isActive()` can only return `true` if `this.webSocket` is truthy. (We can't have an active connection without having instantiated a WebSocket. This is confirmed in the code: Connection#isActive calls Connection#isState which calls Connection#getState, which checks if `this.webSocket` is truthy and returns `null` otherwise.)
This commit is contained in:
parent
6320916513
commit
739f88e52e
|
@ -191,7 +191,7 @@
|
|||
if (!allowReconnect) {
|
||||
this.monitor.stop();
|
||||
}
|
||||
if (this.isActive() && this.webSocket) {
|
||||
if (this.isActive()) {
|
||||
return this.webSocket.close();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ class Connection {
|
|||
|
||||
close({allowReconnect} = {allowReconnect: true}) {
|
||||
if (!allowReconnect) { this.monitor.stop() }
|
||||
if (this.isActive() && this.webSocket) {
|
||||
if (this.isActive()) {
|
||||
return this.webSocket.close()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue