Catch backend race
This commit is contained in:
parent
097a6f4b53
commit
9522729fa0
@ -67,10 +67,26 @@ settings.process(config)
|
||||
logg.debug('settings:\n{}'.format(settings))
|
||||
|
||||
|
||||
def process_outgoing(chain_spec, adapter, rpc, limit=100):
|
||||
upcoming = adapter.upcoming()
|
||||
logg.info('process {} {} {}'.format(chain_spec, adapter, rpc))
|
||||
logg.info('upcoming {}'.format(upcoming))
|
||||
def process_outgoing(chain_spec, adapter, rpc, limit=50):
|
||||
adapter = None
|
||||
process_err = None
|
||||
for i in range(2):
|
||||
try:
|
||||
adapter = ChaindFsAdapter(
|
||||
settings.get('CHAIN_SPEC'),
|
||||
settings.dir_for('queue'),
|
||||
EthCacheTx,
|
||||
dispatcher,
|
||||
)
|
||||
except BackendIntegrityError as e:
|
||||
process_err = e
|
||||
continue
|
||||
|
||||
if adapter == None:
|
||||
raise BackendIntegrityError(process_err)
|
||||
|
||||
upcoming = adapter.upcoming(limit=limit)
|
||||
logg.info('processor has {} candidates for {}, processing with limit {} adapter {} rpc {}'.format(len(upcoming), chain_spec, limit, adapter, rpc))
|
||||
i = 0
|
||||
for tx_hash in upcoming:
|
||||
if adapter.dispatch(tx_hash):
|
||||
|
@ -8,7 +8,6 @@ import chainsyncer.cli
|
||||
import chaind.cli
|
||||
from chaind.setup import Environment
|
||||
from chaind.filter import StateFilter
|
||||
from chaind.adapters.fs import ChaindFsAdapter
|
||||
from chainlib.eth.block import block_latest
|
||||
from hexathon import strip_0x
|
||||
from chainsyncer.store.fs import SyncFsStore
|
||||
@ -59,13 +58,7 @@ logg.debug('settings:\n{}'.format(settings))
|
||||
|
||||
|
||||
def main():
|
||||
queue_adapter = ChaindFsAdapter(
|
||||
settings.get('CHAIN_SPEC'),
|
||||
settings.dir_for('queue'),
|
||||
EthCacheTx,
|
||||
None,
|
||||
)
|
||||
fltr = StateFilter(queue_adapter)
|
||||
fltr = StateFilter(settings.get('CHAIN_SPEC'), settings.dir_for('queue'), EthCacheTx)
|
||||
sync_store = SyncFsStore(settings.get('SESSION_DATA_DIR'), session_id=settings.get('SESSION_ID'))
|
||||
sync_store.register(fltr)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
chaind~=0.1.3
|
||||
chaind~=0.2.0
|
||||
hexathon~=0.1.5
|
||||
chainlib-eth~=0.1.1
|
||||
pyxdg~=0.27
|
||||
|
Loading…
Reference in New Issue
Block a user