log error when step in sync process fails.
This commit is contained in:
parent
4f5206d18e
commit
ea2fcb56ab
2 changed files with 19 additions and 18 deletions
server/utils/chainquery
|
@ -52,8 +52,10 @@ export async function claimSync () {
|
||||||
let claims = JSON.parse(claimsResponse).data;
|
let claims = JSON.parse(claimsResponse).data;
|
||||||
status.info = 'addingClaimsToElastic';
|
status.info = 'addingClaimsToElastic';
|
||||||
for (let claim of claims) {
|
for (let claim of claims) {
|
||||||
const parsedClaim = JSON.parse(claim.value);
|
if (!claim.value) {
|
||||||
if (parsedClaim.Claim) {
|
console.log(claim);
|
||||||
|
await logErrorToSlack('Failed to process claim ' + claim.claimId + ' due to missing value');
|
||||||
|
}
|
||||||
claim.value = JSON.parse(claim.value).Claim;
|
claim.value = JSON.parse(claim.value).Claim;
|
||||||
if (claim.name && claim.value) {
|
if (claim.name && claim.value) {
|
||||||
claim.suggest_name = {
|
claim.suggest_name = {
|
||||||
|
@ -68,7 +70,6 @@ export async function claimSync () {
|
||||||
}
|
}
|
||||||
lastID = claim.id;
|
lastID = claim.id;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
winston.log('info', '[Importer] Pushed ' + claims.length + ' claims to elastic search [LastID]' + lastID);
|
winston.log('info', '[Importer] Pushed ' + claims.length + ' claims to elastic search [LastID]' + lastID);
|
||||||
finished = claims.length < groupSize;
|
finished = claims.length < groupSize;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,7 @@ export async function claimSync () {
|
||||||
await sleep(600000);
|
await sleep(600000);
|
||||||
claimSync();
|
claimSync();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logErrorToSlack(err);
|
await logErrorToSlack(err);
|
||||||
status.err = err;
|
status.err = err;
|
||||||
await sleep(600000);
|
await sleep(600000);
|
||||||
claimSync();
|
claimSync();
|
||||||
|
@ -185,7 +186,7 @@ function getClaimsSince (time, lastID, MaxClaimsInCall) {
|
||||||
`ORDER BY c.id ` +
|
`ORDER BY c.id ` +
|
||||||
`LIMIT ` + MaxClaimsInCall;
|
`LIMIT ` + MaxClaimsInCall;
|
||||||
// Outputs full query to console for copy/paste into chainquery (debugging)
|
// Outputs full query to console for copy/paste into chainquery (debugging)
|
||||||
// console.log(query);
|
console.log(query);
|
||||||
rp(`https://chainquery.lbry.io/api/sql?query=` + query)
|
rp(`https://chainquery.lbry.io/api/sql?query=` + query)
|
||||||
.then(function (htmlString) {
|
.then(function (htmlString) {
|
||||||
resolve(htmlString);
|
resolve(htmlString);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue