Fix last(?) leak in syncer
Signed-off-by: nolash <dev@holbrook.no>
This commit is contained in:
parent
32ce706b2d
commit
c9a69d8658
@ -78,7 +78,7 @@ logg.debug('config loaded from {}:\n{}'.format(args.c, config))
|
|||||||
|
|
||||||
# connect to database
|
# connect to database
|
||||||
dsn = dsn_from_config(config)
|
dsn = dsn_from_config(config)
|
||||||
SessionBase.connect(dsn, pool)
|
SessionBase.connect(dsn, pool_size=8, debug=config.true('DATABASE_DEBUG'))
|
||||||
|
|
||||||
# verify database connection with minimal sanity query
|
# verify database connection with minimal sanity query
|
||||||
session = SessionBase.create_session()
|
session = SessionBase.create_session()
|
||||||
|
@ -36,6 +36,7 @@ class SyncerBackend:
|
|||||||
if self.db_object == None:
|
if self.db_object == None:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
raise ValueError('sync entry with id {} not found'.format(self.object_id))
|
raise ValueError('sync entry with id {} not found'.format(self.object_id))
|
||||||
|
return self.db_session
|
||||||
|
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
|
@ -56,7 +56,8 @@ class MinedSyncer(Syncer):
|
|||||||
# TODO: ensure filter loop can complete on graceful shutdown
|
# TODO: ensure filter loop can complete on graceful shutdown
|
||||||
for f in self.filter:
|
for f in self.filter:
|
||||||
#try:
|
#try:
|
||||||
task_uuid = f(w3, tx, rcpt, self.chain(), self.db_session)
|
session = self.bc_cache.connect()
|
||||||
|
task_uuid = f(w3, tx, rcpt, self.chain(), session)
|
||||||
#except Exception as e:
|
#except Exception as e:
|
||||||
# logg.error('error in filter {} tx {}: {}'.format(f, tx_hash_hex, e))
|
# logg.error('error in filter {} tx {}: {}'.format(f, tx_hash_hex, e))
|
||||||
# continue
|
# continue
|
||||||
|
@ -212,6 +212,7 @@ services:
|
|||||||
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}
|
||||||
|
DATABASE_DEBUG: ${DATABASE_DEBUG:-0}
|
||||||
PGPASSWORD: ${DATABASE_PASSWORD:-tralala}
|
PGPASSWORD: ${DATABASE_PASSWORD:-tralala}
|
||||||
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
||||||
BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor}
|
BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor}
|
||||||
@ -252,6 +253,8 @@ services:
|
|||||||
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}
|
||||||
|
#DATABASE_DEBUG: ${DATABASE_DEBUG:-0}
|
||||||
|
DATABASE_DEBUG: 1
|
||||||
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
||||||
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
||||||
#BANCOR_DIR: $BANCOR_DIR
|
#BANCOR_DIR: $BANCOR_DIR
|
||||||
@ -288,6 +291,7 @@ services:
|
|||||||
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}
|
||||||
|
DATABASE_DEBUG: ${DATABASE_DEBUG:-0}
|
||||||
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
||||||
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
||||||
#BANCOR_DIR: $BANCOR_DIR
|
#BANCOR_DIR: $BANCOR_DIR
|
||||||
@ -324,6 +328,7 @@ services:
|
|||||||
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}
|
||||||
|
DATABASE_DEBUG: ${DATABASE_DEBUG:-0}
|
||||||
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
|
||||||
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
||||||
#BANCOR_DIR: $BANCOR_DIR
|
#BANCOR_DIR: $BANCOR_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user