From 9119c04f1f6f9e7cc1b6a01e621c373bb6818b37 Mon Sep 17 00:00:00 2001 From: nolash Date: Tue, 2 Mar 2021 16:49:30 +0100 Subject: [PATCH] Handle single dict input to account tx list, add ext module to tasker --- apps/cic-eth/cic_eth/api/api_task.py | 5 +++-- apps/cic-eth/cic_eth/ext/tx.py | 3 +++ apps/cic-eth/cic_eth/runnable/daemons/tasker.py | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/cic-eth/cic_eth/api/api_task.py b/apps/cic-eth/cic_eth/api/api_task.py index 8522ffbd..1e6a891e 100644 --- a/apps/cic-eth/cic_eth/api/api_task.py +++ b/apps/cic-eth/cic_eth/api/api_task.py @@ -490,7 +490,7 @@ class Api: queue=self.queue, ) if self.callback_param != None: - s_assemble.link(self.callback_success).on_error(self.callback_error) + s_brief.link(self.callback_success).on_error(self.callback_error) t = None if external_task != None: @@ -515,7 +515,8 @@ class Api: c = celery.chain(s_external_get, s_external_process) t = celery.chord([s_local, c])(s_brief) else: - t = s_local.apply_sync() + s_local.link(s_brief) + t = s_local.apply_async() return t diff --git a/apps/cic-eth/cic_eth/ext/tx.py b/apps/cic-eth/cic_eth/ext/tx.py index 340f77be..6934b8c7 100644 --- a/apps/cic-eth/cic_eth/ext/tx.py +++ b/apps/cic-eth/cic_eth/ext/tx.py @@ -149,6 +149,9 @@ def tx_collate(tx_batches, chain_str, offset, limit, newest_first=True): txs_by_block = {} chain_spec = ChainSpec.from_chain_str(chain_str) + if isinstance(tx_batches, dict): + tx_batches = [tx_batches] + for b in tx_batches: for v in b.values(): tx = None diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index 9a4bb2c8..4efb4cca 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -40,6 +40,8 @@ from cic_eth.callbacks import redis from cic_eth.db.models.base import SessionBase from cic_eth.db.models.otx import Otx from cic_eth.db import dsn_from_config +from cic_eth.ext import tx +from cic_eth.ext import address logging.basicConfig(level=logging.WARNING) logg = logging.getLogger()