connectordb/_websocket.py
def __reconnect(self):
        """This is called when a connection is lost - it attempts to reconnect to the server"""
        self.status = "reconnecting"

        # Reset the disconnect time after 15 minutes
        if self.disconnected_time - self.connected_time > 15 * 60:
            self.reconnect_time = self.reconnect_time_starting_seconds
        else:
            self.reconnect_time *= self.reconnect_time_backoff_multiplier

        if self.reconnect_time > self.reconnect_time_max_seconds:
            self.reconnect_time = self.reconnect_time_max_seconds

        # We want to add some randomness to the reconnect rate - necessary so that we don't pound the server
        # if it goes down
        self.reconnect_time *= 1 + random.uniform(-0.2, 0.2)

        if self.reconnect_time < self.reconnect_time_starting_seconds:
            self.reconnect_time = self.reconnect_time_starting_seconds

        logging.warn("ConnectorDB:WS: Attempting to reconnect in %fs",
                     self.reconnect_time)

        self.reconnector = threading.Timer(self.reconnect_time,
                                           self.__reconnect_fnc)
        self.reconnector.daemon = True
        self.reconnector.start()
def __reconnect(self):
        self.status = "reconnecting"

        # Reset the disconnect time after 15 minutes
        if self.disconnected_time - self.connected_time > 15 * 60:
            self.reconnect_time = self.reconnect_time_starting_seconds
        else:
            self.reconnect_time *= self.reconnect_time_backoff_multiplier

        if self.reconnect_time > self.reconnect_time_max_seconds:
            self.reconnect_time = self.reconnect_time_max_seconds

        # We want to add some randomness to the reconnect rate - necessary so that we don't pound the server
        # if it goes down
        self.reconnect_time *= 1 + random.uniform(-0.2, 0.2)

        if self.reconnect_time < self.reconnect_time_starting_seconds:
            self.reconnect_time = self.reconnect_time_starting_seconds

        logging.warn("ConnectorDB:WS: Attempting to reconnect in %fs",
                     self.reconnect_time)

        self.reconnector = threading.Timer(self.reconnect_time,
                                           self.__reconnect_fnc)
        self.reconnector.daemon = True
        self.reconnector.start()
def __reconnect ( self ) : self . status = "reconnecting" # Reset the disconnect time after 15 minutes if self . disconnected_time - self . connected_time > 15 * 60 : self . reconnect_time = self . reconnect_time_starting_seconds else : self . reconnect_time *= self . reconnect_time_backoff_multiplier if self . reconnect_time > self . reconnect_time_max_seconds : self . reconnect_time = self . reconnect_time_max_seconds # We want to add some randomness to the reconnect rate - necessary so that we don't pound the server # if it goes down self . reconnect_time *= 1 + random . uniform ( - 0.2 , 0.2 ) if self . reconnect_time < self . reconnect_time_starting_seconds : self . reconnect_time = self . reconnect_time_starting_seconds logging . warn ( "ConnectorDB:WS: Attempting to reconnect in %fs" , self . reconnect_time ) self . reconnector = threading . Timer ( self . reconnect_time , self . __reconnect_fnc ) self . reconnector . daemon = True self . reconnector . start ( )
This is called when a connection is lost - it attempts to reconnect to the server
This is called when a connection is lost - it attempts to reconnect to the server