mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 06:55:45 +00:00
Merge pull request #8 from liviu-lesan/planetmint-tarantool
fix for flush function (freezing of pytest) + NoneType error
This commit is contained in:
commit
b5c495aedb
@ -413,7 +413,7 @@ def store_validator_set(conn, validators_update: dict):
|
|||||||
_validator = conn.run(
|
_validator = conn.run(
|
||||||
conn.space("validators").select(validators_update["height"], index="height_search", limit=1)
|
conn.space("validators").select(validators_update["height"], index="height_search", limit=1)
|
||||||
)
|
)
|
||||||
unique_id = token_hex(8) if _validator is None or len(_validator.data) == 0 else _validator.data[0][0]
|
unique_id = token_hex(8) if _validator is None or len(_validator) == 0 else _validator.data[0][0]
|
||||||
conn.run(
|
conn.run(
|
||||||
conn.space("validators").upsert((unique_id, validators_update["height"], validators_update["validators"]),
|
conn.space("validators").upsert((unique_id, validators_update["height"], validators_update["validators"]),
|
||||||
op_list=[('=', 0, unique_id),
|
op_list=[('=', 0, unique_id),
|
||||||
|
|||||||
@ -33,15 +33,16 @@ def flush_localmongo_db(connection, dbname):
|
|||||||
@flush_db.register(TarantoolDBConnection)
|
@flush_db.register(TarantoolDBConnection)
|
||||||
def flush_tarantool_db(connection, dbname):
|
def flush_tarantool_db(connection, dbname):
|
||||||
for s in SPACE_NAMES:
|
for s in SPACE_NAMES:
|
||||||
_space = connection.space(space_name=s)
|
_all_data = connection.run(connection.space(s).select([]))
|
||||||
_all_data = _space.select([]).data
|
if _all_data is None:
|
||||||
|
continue
|
||||||
for _id in _all_data:
|
for _id in _all_data:
|
||||||
if "assets" == s:
|
if "assets" == s:
|
||||||
_space.delete(_id[1])
|
connection.run(connection.space(s).delete(_id[1]), only_data=False)
|
||||||
elif "abci_chains" == s:
|
elif "abci_chains" == s:
|
||||||
_space.delete(_id[2])
|
connection.run(connection.space(s).delete(_id[2], only_data=False))
|
||||||
else:
|
else:
|
||||||
_space.delete(_id[0])
|
connection.run(connection.space(s).delete(_id[0], only_data=False))
|
||||||
|
|
||||||
|
|
||||||
def generate_block(planet):
|
def generate_block(planet):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user