Add race delay

This commit is contained in:
lash 2022-05-01 06:27:52 +00:00
parent 04d9901f0d
commit f7c09acfe2
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -2,6 +2,7 @@
import re import re
import datetime import datetime
import logging import logging
import time
# local imports # local imports
from chainqueue.cache import CacheTx from chainqueue.cache import CacheTx
@ -31,6 +32,8 @@ all_local_errors = all_errors() - StatusBits.NETWORK_ERROR
re_u = r'^[^_][_A-Z]+$' re_u = r'^[^_][_A-Z]+$'
class Store: class Store:
race_delay = 0.1
def __init__(self, chain_spec, state_store, index_store, counter, cache=None): def __init__(self, chain_spec, state_store, index_store, counter, cache=None):
self.chain_spec = chain_spec self.chain_spec = chain_spec
self.cache = cache self.cache = cache
@ -58,6 +61,7 @@ class Store:
self.state_store.sync() self.state_store.sync()
except Exception as e: except Exception as e:
sync_err = e sync_err = e
time.sleep(self.race_delay)
continue continue
if sync_err != None: if sync_err != None: