close db in sync script
This commit is contained in:
parent
4ce16b6509
commit
92be63ff5b
1 changed files with 10 additions and 2 deletions
|
@ -21,8 +21,16 @@ async def get_all_claims(index_name='claims', db=None):
|
||||||
db = db or LevelDB(env)
|
db = db or LevelDB(env)
|
||||||
if need_open:
|
if need_open:
|
||||||
await db.open_dbs()
|
await db.open_dbs()
|
||||||
for claim in db.all_claims_producer():
|
try:
|
||||||
yield extract_doc(claim, index_name)
|
cnt = 0
|
||||||
|
for claim in db.all_claims_producer():
|
||||||
|
yield extract_doc(claim, index_name)
|
||||||
|
cnt += 1
|
||||||
|
if cnt % 10000 == 0:
|
||||||
|
print(f"{cnt} claims sent")
|
||||||
|
finally:
|
||||||
|
if need_open:
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
async def make_es_index(index=None):
|
async def make_es_index(index=None):
|
||||||
|
|
Loading…
Reference in a new issue