def main(): watchers = [ WatchMembershipNewOrder(), WatchMembershipCancelOrder(), WatchMembershipBuyAgreement(), WatchMembershipSellAgreement(), WatchMembershipBuySettlementOK(), WatchMembershipSellSettlementOK(), WatchMembershipBuySettlementNG(), WatchMembershipSellSettlementNG(), ] e = ThreadPoolExecutor(max_workers=WORKER_COUNT) LOG.info("Service started successfully") while True: start_time = time.time() fs = [] for watcher in watchers: fs.append(e.submit(watcher.loop)) wait_all_futures(fs) elapsed_time = time.time() - start_time LOG.info("[LOOP] finished in {} secs".format(elapsed_time)) time.sleep(max(SLEEP_INTERVAL - elapsed_time, 0))
def main(): watchers = [ WatchStartOffering(), WatchStopOffering(), WatchSuspend(), WatchApplyForOffering(), WatchTransfer(), WatchAllot(), ] e = ThreadPoolExecutor(max_workers=WORKER_COUNT) LOG.info("Service started successfully") while True: start_time = time.time() fs = [] for watcher in watchers: fs.append(e.submit(watcher.loop)) wait_all_futures(fs) elapsed_time = time.time() - start_time LOG.info("[LOOP] finished in {} secs".format(elapsed_time)) time.sleep(max(SLEEP_INTERVAL - elapsed_time, 0))
def main(): watchers = [ WatchBlockSyncState(), ] e = ThreadPoolExecutor(max_workers=WORKER_COUNT) LOG.info("Service started successfully") while True: start_time = time.time() fs = [] for watcher in watchers: fs.append(e.submit(watcher.loop)) wait_all_futures(fs) elapsed_time = time.time() - start_time LOG.info("[LOOP] finished in {} secs".format(elapsed_time)) time.sleep(max(BLOCK_SYNC_STATUS_SLEEP_INTERVAL - elapsed_time, 0))
def main(): watchers = [ WatchPaymentAccountRegister(), WatchPaymentAccountApprove(), WatchPaymentAccountWarn(), WatchPaymentAccountUnapprove(), WatchPaymentAccountBan(), ] e = ThreadPoolExecutor(max_workers=WORKER_COUNT) LOG.info("Service started successfully") while True: start_time = time.time() fs = [] for watcher in watchers: fs.append(e.submit(watcher.loop)) wait_all_futures(fs) elapsed_time = time.time() - start_time LOG.info("[LOOP] finished in {} secs".format(elapsed_time)) time.sleep(max(SLEEP_INTERVAL - elapsed_time, 0))