Make lock tasks critical db tasks
This commit is contained in:
parent
16ea3f3db8
commit
67330b2ad5
@ -10,12 +10,15 @@ from cic_registry import zero_address
|
|||||||
from cic_eth.db.enum import LockEnum
|
from cic_eth.db.enum import LockEnum
|
||||||
from cic_eth.db.models.base import SessionBase
|
from cic_eth.db.models.base import SessionBase
|
||||||
from cic_eth.db.models.lock import Lock
|
from cic_eth.db.models.lock import Lock
|
||||||
|
from cic_eth.task import (
|
||||||
|
CriticalSQLAlchemyTask,
|
||||||
|
)
|
||||||
from cic_eth.error import LockedError
|
from cic_eth.error import LockedError
|
||||||
|
|
||||||
celery_app = celery.current_app
|
celery_app = celery.current_app
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def lock(chained_input, chain_str, address=zero_address, flags=LockEnum.ALL, tx_hash=None):
|
def lock(chained_input, chain_str, address=zero_address, flags=LockEnum.ALL, tx_hash=None):
|
||||||
"""Task wrapper to set arbitrary locks
|
"""Task wrapper to set arbitrary locks
|
||||||
|
|
||||||
@ -33,7 +36,7 @@ def lock(chained_input, chain_str, address=zero_address, flags=LockEnum.ALL, tx_
|
|||||||
return chained_input
|
return chained_input
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def unlock(chained_input, chain_str, address=zero_address, flags=LockEnum.ALL):
|
def unlock(chained_input, chain_str, address=zero_address, flags=LockEnum.ALL):
|
||||||
"""Task wrapper to reset arbitrary locks
|
"""Task wrapper to reset arbitrary locks
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ def unlock(chained_input, chain_str, address=zero_address, flags=LockEnum.ALL):
|
|||||||
return chained_input
|
return chained_input
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def lock_send(chained_input, chain_str, address=zero_address, tx_hash=None):
|
def lock_send(chained_input, chain_str, address=zero_address, tx_hash=None):
|
||||||
"""Task wrapper to set send lock
|
"""Task wrapper to set send lock
|
||||||
|
|
||||||
@ -67,7 +70,7 @@ def lock_send(chained_input, chain_str, address=zero_address, tx_hash=None):
|
|||||||
return chained_input
|
return chained_input
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def unlock_send(chained_input, chain_str, address=zero_address):
|
def unlock_send(chained_input, chain_str, address=zero_address):
|
||||||
"""Task wrapper to reset send lock
|
"""Task wrapper to reset send lock
|
||||||
|
|
||||||
@ -83,7 +86,7 @@ def unlock_send(chained_input, chain_str, address=zero_address):
|
|||||||
return chained_input
|
return chained_input
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def lock_queue(chained_input, chain_str, address=zero_address, tx_hash=None):
|
def lock_queue(chained_input, chain_str, address=zero_address, tx_hash=None):
|
||||||
"""Task wrapper to set queue direct lock
|
"""Task wrapper to set queue direct lock
|
||||||
|
|
||||||
@ -99,7 +102,7 @@ def lock_queue(chained_input, chain_str, address=zero_address, tx_hash=None):
|
|||||||
return chained_input
|
return chained_input
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def unlock_queue(chained_input, chain_str, address=zero_address):
|
def unlock_queue(chained_input, chain_str, address=zero_address):
|
||||||
"""Task wrapper to reset queue direct lock
|
"""Task wrapper to reset queue direct lock
|
||||||
|
|
||||||
@ -115,7 +118,7 @@ def unlock_queue(chained_input, chain_str, address=zero_address):
|
|||||||
return chained_input
|
return chained_input
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def check_lock(chained_input, chain_str, lock_flags, address=None):
|
def check_lock(chained_input, chain_str, lock_flags, address=None):
|
||||||
session = SessionBase.create_session()
|
session = SessionBase.create_session()
|
||||||
r = Lock.check(chain_str, lock_flags, address=zero_address, session=session)
|
r = Lock.check(chain_str, lock_flags, address=zero_address, session=session)
|
||||||
|
@ -14,6 +14,7 @@ from cic_eth.db import Otx, SessionBase
|
|||||||
from cic_eth.db.models.tx import TxCache
|
from cic_eth.db.models.tx import TxCache
|
||||||
from cic_eth.db.models.nonce import NonceReservation
|
from cic_eth.db.models.nonce import NonceReservation
|
||||||
from cic_eth.db.models.lock import Lock
|
from cic_eth.db.models.lock import Lock
|
||||||
|
from cic_eth.db.models.role import AccountRole
|
||||||
from cic_eth.db.enum import (
|
from cic_eth.db.enum import (
|
||||||
LockEnum,
|
LockEnum,
|
||||||
StatusBits,
|
StatusBits,
|
||||||
|
@ -97,6 +97,7 @@ def register_eth(i, u):
|
|||||||
callback_queue=args.q,
|
callback_queue=args.q,
|
||||||
)
|
)
|
||||||
t = api.create_account(register=True)
|
t = api.create_account(register=True)
|
||||||
|
logg.debug('register {} -> {}'.format(u, t))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
ps.get_message()
|
ps.get_message()
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
cic-base[full_graph]==0.1.1a23
|
cic-base[full_graph]==0.1.1a23
|
||||||
cic-eth==0.10.0a40
|
cic-eth==0.10.0a41
|
||||||
cic-types==0.1.0a8
|
cic-types==0.1.0a8
|
||||||
|
@ -31,7 +31,7 @@ set -e
|
|||||||
set -a
|
set -a
|
||||||
|
|
||||||
# We need to not install these here...
|
# We need to not install these here...
|
||||||
pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a40 chainlib==0.0.1a21 cic-contracts==0.0.2a2
|
pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a41 chainlib==0.0.1a21 cic-contracts==0.0.2a2
|
||||||
|
|
||||||
>&2 echo "create account for gas gifter"
|
>&2 echo "create account for gas gifter"
|
||||||
old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER
|
old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER
|
||||||
|
Loading…
Reference in New Issue
Block a user