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