log error when step in sync process fails.

This commit is contained in:
Mark Beamer Jr 2019-06-21 00:11:16 -04:00
parent 4f5206d18e
commit ea2fcb56ab
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973
2 changed files with 19 additions and 18 deletions

View file

@ -479,7 +479,7 @@ class LighthouseControllers {
}
if (pResult._source.value &&
pResult._source.value.stream &&
pResult._source.value.stream !== undefined){
pResult._source.value.stream !== undefined) {
var title = pResult._source.value.stream.metadata.title;
var author = pResult._source.value.stream.metadata.author;
if (title.indexOf(ctx.query.s.trim()) > -1 && title.indexOf('http') === -1) {

View file

@ -52,22 +52,23 @@ export async function claimSync () {
let claims = JSON.parse(claimsResponse).data;
status.info = 'addingClaimsToElastic';
for (let claim of claims) {
const parsedClaim = JSON.parse(claim.value);
if (parsedClaim.Claim) {
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;
if (!claim.value) {
console.log(claim);
await logErrorToSlack('Failed to process claim ' + claim.claimId + ' due to missing value');
}
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);
finished = claims.length < groupSize;
@ -80,7 +81,7 @@ export async function claimSync () {
await sleep(600000);
claimSync();
} catch (err) {
logErrorToSlack(err);
await logErrorToSlack(err);
status.err = err;
await sleep(600000);
claimSync();
@ -185,7 +186,7 @@ function getClaimsSince (time, lastID, MaxClaimsInCall) {
`ORDER BY c.id ` +
`LIMIT ` + MaxClaimsInCall;
// 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)
.then(function (htmlString) {
resolve(htmlString);