Ejemplo n.º 1
0
 def broadcast(self, message):
     for site in self.sites.values():
         request = MgtRequest(message.serialize())
         try:
             request.get_response(site.mgt_address)
         except:
             # the site is down
             logger.critical('REP: Site %s is down.' % (site.mgt_address, ))
Ejemplo n.º 2
0
 def __maintain(self):
     "deadlock detection thread"
     while self._running:
         time.sleep(0.01)
         # deadlock detection
         try:
             aborted = self._env.lock_detect(db.DB_LOCK_YOUNGEST)
             if aborted:
                 logger.critical(
                     "Deadlock: Aborted %d deadlocked transaction(s)"
                     % aborted)
         except db.DBError:
             pass
Ejemplo n.º 3
0
 def __maintain(self):
     "deadlock detection thread"
     while self._running:
         time.sleep(0.01)
         # deadlock detection
         try:
             aborted = self._env.lock_detect(db.DB_LOCK_YOUNGEST)
             if aborted:
                 logger.critical(
                     "Deadlock: Aborted %d deadlocked transaction(s)" %
                     aborted)
         except db.DBError:
             pass
def __maintain():
    from porcupine.db import _db
    while _running:
        time.sleep(2.0)
        # deadlock detection
        try:
            aborted = _env.lock_detect(db.DB_LOCK_RANDOM, db.DB_LOCK_CONFLICT)
            if aborted:
                _db._activeTxns -= aborted
                logger.critical("Deadlock: Aborted %d deadlocked transaction(s)"
                                % aborted)
        except db.DBError:
            pass
        # checkpoint
        _env.txn_checkpoint(0, _checkpoint_interval, 0)