Check errors only on first connect. Keep retrying after first connection succeeds. (mattermost) Closes #95
This commit is contained in:
parent
fee159541f
commit
adec73f542
|
@ -80,6 +80,11 @@ func (m *MMClient) SetLogLevel(level string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MMClient) Login() error {
|
func (m *MMClient) Login() error {
|
||||||
|
// check if this is a first connect or a reconnection
|
||||||
|
firstConnection := true
|
||||||
|
if m.WsConnected == true {
|
||||||
|
firstConnection = false
|
||||||
|
}
|
||||||
m.WsConnected = false
|
m.WsConnected = false
|
||||||
if m.WsQuit {
|
if m.WsQuit {
|
||||||
return nil
|
return nil
|
||||||
|
@ -125,11 +130,7 @@ func (m *MMClient) Login() error {
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
d := b.Duration()
|
d := b.Duration()
|
||||||
m.log.Debug(appErr.DetailedError)
|
m.log.Debug(appErr.DetailedError)
|
||||||
//TODO more generic fix needed
|
if firstConnection {
|
||||||
if !strings.Contains(appErr.DetailedError, "connection refused") &&
|
|
||||||
!strings.Contains(appErr.DetailedError, "invalid character") &&
|
|
||||||
!strings.Contains(appErr.DetailedError, "connection reset by peer") &&
|
|
||||||
!strings.Contains(appErr.DetailedError, "connection timed out") {
|
|
||||||
if appErr.Message == "" {
|
if appErr.Message == "" {
|
||||||
return errors.New(appErr.DetailedError)
|
return errors.New(appErr.DetailedError)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue