Make connection timeout configurable
This commit is contained in:
6
user.go
6
user.go
@ -145,7 +145,11 @@ func (user *User) Connect(evenIfNoSession bool) bool {
|
||||
return false
|
||||
}
|
||||
user.log.Debugln("Connecting to WhatsApp")
|
||||
conn, err := whatsapp.NewConn(20 * time.Second)
|
||||
timeout := time.Duration(user.bridge.Config.Bridge.ConnectionTimeout)
|
||||
if timeout == 0 {
|
||||
timeout = 20
|
||||
}
|
||||
conn, err := whatsapp.NewConn(timeout * time.Second)
|
||||
if err != nil {
|
||||
user.log.Errorln("Failed to connect to WhatsApp:", err)
|
||||
return false
|
||||
|
Reference in New Issue
Block a user