Ignore missing txs, sync store on start

This commit is contained in:
lash 2022-04-10 15:30:08 +00:00
parent 01b674d09e
commit b5f513b63a
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -6,6 +6,7 @@ import logging
# local imports # local imports
from chainqueue.cache import CacheTx from chainqueue.cache import CacheTx
from chainqueue.entry import QueueEntry from chainqueue.entry import QueueEntry
from chainqueue.error import NotLocalTxError
logg = logging.getLogger(__name__) logg = logging.getLogger(__name__)
@ -42,6 +43,7 @@ class Store:
'modified', 'modified',
]: ]:
setattr(self, v, getattr(self.state_store, v)) setattr(self, v, getattr(self.state_store, v))
self.state_store.sync()
def put(self, v, cache_adapter=CacheTx): def put(self, v, cache_adapter=CacheTx):
@ -59,7 +61,10 @@ class Store:
def get(self, k): def get(self, k):
s = self.index_store.get(k) try:
s = self.index_store.get(k)
except FileNotFoundError:
raise NotLocalTxError(k)
v = self.state_store.get(s) v = self.state_store.get(s)
return (s, v,) return (s, v,)
@ -128,7 +133,6 @@ class Store:
def final(self, k, block, tx, error=False): def final(self, k, block, tx, error=False):
entry = QueueEntry(self, k) entry = QueueEntry(self, k)
entry.load() entry.load()
logg.debug('entry {} {}'.format(k, entry.k))
if error: if error:
entry.fail(block, tx) entry.fail(block, tx)
else: else: