From 42f2a6386c1675518cc383178e6568667cc512b3 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 2 Oct 2019 18:04:17 +0200 Subject: [PATCH] possibly improve memory management --- server/utils/chainquery/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/utils/chainquery/index.js b/server/utils/chainquery/index.js index d15f4b2..04d4383 100644 --- a/server/utils/chainquery/index.js +++ b/server/utils/chainquery/index.js @@ -76,9 +76,9 @@ export async function claimSync () { }; } if (claim.bid_state === 'Spent' || claim.bid_state === 'Expired') { - deleteFromElastic(claim.claimId); + await deleteFromElastic(claim.claimId); } else { - pushElastic(claim); + await pushElastic(claim); } lastID = claim.id; } @@ -86,7 +86,7 @@ export async function claimSync () { finished = claims.length < BatchSize || (iteration * BatchSize + BatchSize >= MaxClaimsToProcessPerIteration); iteration++; } - deleteBlockedClaims(); + await deleteBlockedClaims(); // If not finished, store last id to run again later where we left off, otherwise update last sync time. if (iteration * BatchSize + BatchSize >= MaxClaimsToProcessPerIteration) { syncState.LastID = lastID; @@ -98,12 +98,12 @@ export async function claimSync () { status.info = 'upToDate'; status.syncState = syncState; await sleep(600000); - claimSync(); + await claimSync(); } catch (err) { await logErrorToSlack(err); status.err = err; await sleep(600000); - claimSync(); + await claimSync(); } }