Only force disconnect if we are connected

feature/embed-uploads
Tristan Gosselin-Hane 7 years ago
parent 34b5ea94e6
commit 968c4b0dd3
No known key found for this signature in database
GPG Key ID: 86886FC44C72EAA1
  1. 5
      webhook-bridge.py

@ -34,6 +34,7 @@ from bidict import bidict
log = logging.getLogger("bridge") log = logging.getLogger("bridge")
SESSION_TOKEN = ""
UUID_CACHE = bidict() UUID_CACHE = bidict()
WEBHOOKS = [] WEBHOOKS = []
BOT_USERNAME = "" BOT_USERNAME = ""
@ -182,7 +183,9 @@ def main():
PREVIOUS_PLAYER_LIST = PLAYER_LIST.copy() PREVIOUS_PLAYER_LIST = PLAYER_LIST.copy()
ACCEPT_JOIN_EVENTS = False ACCEPT_JOIN_EVENTS = False
PLAYER_LIST = bidict() PLAYER_LIST = bidict()
connection.disconnect(immediate=True) if connection.connected:
log.info("Forced a disconnection because the connection is still connected.")
connection.disconnect(immediate=True)
time.sleep(15) time.sleep(15)
while not is_server_online(): while not is_server_online():
log.info('Not reconnecting to server because it appears to be offline.') log.info('Not reconnecting to server because it appears to be offline.')

Loading…
Cancel
Save