예제 #1
0
파일: client.py 프로젝트: dpays/hivemind
    def __exec(self, method, params=None):
        """Perform a single dpayd call."""
        time_start = time.perf_counter()
        result = self._client.exec(method, params)
        total_time = (time.perf_counter() - time_start) * 1000

        batch_size = len(params[0]) if method == 'get_accounts' else 1
        Stats.log_dpay(method, total_time, batch_size)
        return result
예제 #2
0
파일: client.py 프로젝트: dpays/hivemind
    def __exec_batch(self, method, params):
        """Perform batch call. Based on config uses either batch or futures."""
        time_start = time.perf_counter()

        result = []
        for part in self._client.exec_multi(method,
                                            params,
                                            max_workers=self._max_workers,
                                            batch_size=self._max_batch):
            result.extend(part)

        total_time = (time.perf_counter() - time_start) * 1000
        Stats.log_dpay(method, total_time, len(params))
        return result