Esempio n. 1
0
    async def serviceQueues(self, limit=None) -> int:
        """
        Service at most `limit` messages from the inBox.

        :param limit: the maximum number of messages to service
        :return: the number of messages successfully processed
        """
        # do not start any view changes until catch-up is finished!
        if not Mode.is_done_syncing(self.provider.node_mode()):
            return 0
        return await self.inBoxRouter.handleAll(self.inBox, limit)
Esempio n. 2
0
 def can_send_request(self, request):
     if not Mode.is_done_discovering(self.mode):
         return False
     if self.hasSufficientConnections:
         return True
     if not self.hasAnyConnections:
         return False
     if request.isForced():
         return True
     is_read_only = request.txn_type in self._read_only_requests
     if is_read_only:
         return True
     return False
Esempio n. 3
0
 def can_send_read_requests(self):
     if not Mode.is_done_discovering(self.mode):
         return False
     if not self.hasAnyConnections:
         return False
     return True
Esempio n. 4
0
 def can_send_write_requests(self):
     if not Mode.is_done_discovering(self.mode):
         return False
     if not self.hasSufficientConnections:
         return False
     return True
Esempio n. 5
0
 def is_state_fresh_enough(self):
     threshold = self.config.ACCEPTABLE_FRESHNESS_INTERVALS_COUNT * self.config.STATE_FRESHNESS_UPDATE_INTERVAL
     return self.provider.state_freshness() < threshold or (not self.view_change_in_progress and
                                                            not Mode.is_done_syncing(self.provider.node_mode()))
Esempio n. 6
0
 def is_synced(self) -> bool:
     return Mode.is_done_syncing(self.mode)
Esempio n. 7
0
 def is_synced(self):
     return Mode.is_done_syncing(self.node_mode)