Correct db names in compose, cic-eth query var scope
This commit is contained in:
parent
7b13725c26
commit
2ec785488e
@ -557,27 +557,26 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
|
|||||||
:rtype: dict, with transaction hash as key, signed raw transaction as value
|
:rtype: dict, with transaction hash as key, signed raw transaction as value
|
||||||
"""
|
"""
|
||||||
session = SessionBase.create_session()
|
session = SessionBase.create_session()
|
||||||
q = session.query(
|
q_outer = session.query(
|
||||||
TxCache.sender,
|
TxCache.sender,
|
||||||
func.min(Otx.nonce).label('nonce'),
|
func.min(Otx.nonce).label('nonce'),
|
||||||
)
|
)
|
||||||
q = q.join(TxCache)
|
q_outer = q_outer.join(TxCache)
|
||||||
q = q.join(Lock, isouter=True)
|
q_outer = q_outer.join(Lock, isouter=True)
|
||||||
q = q.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
|
q_outer = q_outer.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
|
||||||
|
|
||||||
if status >= StatusEnum.SENT:
|
if status >= StatusEnum.SENT:
|
||||||
raise ValueError('not a valid non-final tx value: {}'.format(s))
|
raise ValueError('not a valid non-final tx value: {}'.format(s))
|
||||||
q = q.filter(Otx.status==status)
|
q_outer = q_outer.filter(Otx.status==status.value)
|
||||||
|
|
||||||
if recipient != None:
|
if recipient != None:
|
||||||
q = q.filter(TxCache.recipient==recipient)
|
q_outer = q_outer.filter(TxCache.recipient==recipient)
|
||||||
|
|
||||||
q = q.group_by(TxCache.sender)
|
q_outer = q_outer.group_by(TxCache.sender)
|
||||||
|
|
||||||
txs = {}
|
txs = {}
|
||||||
|
|
||||||
results = q.all()
|
for r in q_outer.all():
|
||||||
for r in results:
|
|
||||||
q = session.query(Otx)
|
q = session.query(Otx)
|
||||||
q = q.join(TxCache)
|
q = q.join(TxCache)
|
||||||
q = q.filter(TxCache.sender==r.sender)
|
q = q.filter(TxCache.sender==r.sender)
|
||||||
@ -587,7 +586,6 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
|
|||||||
q = q.filter(TxCache.date_checked<before)
|
q = q.filter(TxCache.date_checked<before)
|
||||||
|
|
||||||
q = q.order_by(TxCache.date_created.desc())
|
q = q.order_by(TxCache.date_created.desc())
|
||||||
|
|
||||||
o = q.first()
|
o = q.first()
|
||||||
|
|
||||||
# TODO: audit; should this be possible if a row is found in the initial query? If not, at a minimum log error.
|
# TODO: audit; should this be possible if a row is found in the initial query? If not, at a minimum log error.
|
||||||
@ -602,7 +600,6 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
|
|||||||
q = q.filter(TxCache.otx_id==o.id)
|
q = q.filter(TxCache.otx_id==o.id)
|
||||||
o = q.first()
|
o = q.first()
|
||||||
|
|
||||||
logg.debug('oooo {}'.format(o))
|
|
||||||
o.date_checked = datetime.datetime.now()
|
o.date_checked = datetime.datetime.now()
|
||||||
session.add(o)
|
session.add(o)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
@ -68,7 +68,7 @@ app = celery.Celery(backend=config.get('CELERY_RESULT_URL'), broker=config.get(
|
|||||||
queue = args.q
|
queue = args.q
|
||||||
|
|
||||||
dsn = dsn_from_config(config)
|
dsn = dsn_from_config(config)
|
||||||
SessionBase.connect(dsn)
|
SessionBase.connect(dsn, debug=config.true('DATABASE_DEBUG'))
|
||||||
|
|
||||||
|
|
||||||
re_websocket = re.compile('^wss?://')
|
re_websocket = re.compile('^wss?://')
|
||||||
|
@ -227,7 +227,7 @@ services:
|
|||||||
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
||||||
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
||||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
||||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
|
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
|
||||||
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
||||||
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
||||||
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
||||||
@ -263,7 +263,7 @@ services:
|
|||||||
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
||||||
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
||||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
||||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
|
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
|
||||||
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
||||||
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
||||||
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
||||||
@ -299,7 +299,7 @@ services:
|
|||||||
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
||||||
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
||||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
||||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
|
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
|
||||||
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
||||||
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
||||||
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
||||||
@ -309,6 +309,7 @@ services:
|
|||||||
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
|
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
|
||||||
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis}
|
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis}
|
||||||
TASKS_TRANSFER_CALLBACKS: $TASKS_TRANSFER_CALLBACKS
|
TASKS_TRANSFER_CALLBACKS: $TASKS_TRANSFER_CALLBACKS
|
||||||
|
DATABASE_DEBUG: ${DATABASE_DEBUG:-true}
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- eth
|
- eth
|
||||||
@ -337,7 +338,7 @@ services:
|
|||||||
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
DATABASE_USER: ${DATABASE_USER:-grassroots}
|
||||||
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
||||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
|
||||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
|
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
|
||||||
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
DATABASE_PORT: ${DATABASE_PORT:-5432}
|
||||||
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
||||||
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
||||||
|
Loading…
Reference in New Issue
Block a user