diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-01 08:27:57 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-01 08:27:57 -0500 |
commit | a66e9513ad48089f16469509ab4fad633f8eaac5 (patch) | |
tree | 8ec3b1be136733b7be7f6aeee2e91b81cebf245c /web/react/stores/socket_store.jsx | |
parent | 39c83f70fc227e9bb88c24b15ff2b8748e9d670b (diff) | |
parent | 6c18e13f8ae4d8785b598adc0cb3e93c27cec849 (diff) | |
download | chat-a66e9513ad48089f16469509ab4fad633f8eaac5.tar.gz chat-a66e9513ad48089f16469509ab4fad633f8eaac5.tar.bz2 chat-a66e9513ad48089f16469509ab4fad633f8eaac5.zip |
Merge pull request #2276 from mattermost/PLT-2030
PLT-2030 fixing error handling
Diffstat (limited to 'web/react/stores/socket_store.jsx')
-rw-r--r-- | web/react/stores/socket_store.jsx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx index efb57e226..9b2b049b7 100644 --- a/web/react/stores/socket_store.jsx +++ b/web/react/stores/socket_store.jsx @@ -58,6 +58,10 @@ class SocketStoreClass extends EventEmitter { if (this.failCount === 0) { console.log('websocket connecting to ' + connUrl); //eslint-disable-line no-console + if (ErrorStore.getConnectionErrorCount() > 0) { + ErrorStore.setConnectionErrorCount(0); + ErrorStore.emitChange(); + } } conn = new WebSocket(connUrl); @@ -65,10 +69,8 @@ class SocketStoreClass extends EventEmitter { if (this.failCount > 0) { console.log('websocket re-established connection'); //eslint-disable-line no-console - if (ErrorStore.getLastError()) { - ErrorStore.storeLastError(null); - ErrorStore.emitChange(); - } + ErrorStore.clearLastError(); + ErrorStore.emitChange(); AsyncClient.getChannels(); AsyncClient.getPosts(ChannelStore.getCurrentId()); @@ -86,7 +88,11 @@ class SocketStoreClass extends EventEmitter { this.failCount = this.failCount + 1; - ErrorStore.storeLastError({connErrorCount: this.failCount, message: this.translations.socketError}); + if (this.failCount > 7) { + ErrorStore.storeLastError({message: this.translations.socketError}); + } + + ErrorStore.setConnectionErrorCount(this.failCount); ErrorStore.emitChange(); setTimeout( |