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
|
@ -479,7 +479,7 @@ class LighthouseControllers {
|
||||||
}
|
}
|
||||||
if (pResult._source.value &&
|
if (pResult._source.value &&
|
||||||
pResult._source.value.stream &&
|
pResult._source.value.stream &&
|
||||||
pResult._source.value.stream !== undefined){
|
pResult._source.value.stream !== undefined) {
|
||||||
var title = pResult._source.value.stream.metadata.title;
|
var title = pResult._source.value.stream.metadata.title;
|
||||||
var author = pResult._source.value.stream.metadata.author;
|
var author = pResult._source.value.stream.metadata.author;
|
||||||
if (title.indexOf(ctx.query.s.trim()) > -1 && title.indexOf('http') === -1) {
|
if (title.indexOf(ctx.query.s.trim()) > -1 && title.indexOf('http') === -1) {
|
||||||
|
|
|
@ -52,22 +52,23 @@ 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);
|
||||||
claim.value = JSON.parse(claim.value).Claim;
|
await logErrorToSlack('Failed to process claim ' + claim.claimId + ' due to missing value');
|
||||||
if (claim.name && claim.value) {
|
|
||||||
claim.suggest_name = {
|
|
||||||
input : '' + claim.name + '',
|
|
||||||
weight: '30',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (claim.bid_state === 'Spent' || claim.bid_state === 'Expired') {
|
|
||||||
deleteFromElastic(claim.claimId);
|
|
||||||
} else {
|
|
||||||
pushElastic(claim);
|
|
||||||
}
|
|
||||||
lastID = claim.id;
|
|
||||||
}
|
}
|
||||||
|
claim.value = JSON.parse(claim.value).Claim;
|
||||||
|
if (claim.name && claim.value) {
|
||||||
|
claim.suggest_name = {
|
||||||
|
input : '' + claim.name + '',
|
||||||
|
weight: '30',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (claim.bid_state === 'Spent' || claim.bid_state === 'Expired') {
|
||||||
|
deleteFromElastic(claim.claimId);
|
||||||
|
} else {
|
||||||
|
pushElastic(claim);
|
||||||
|
}
|
||||||
|
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…
Reference in a new issue