Skip to content

Commit

Permalink
Add extra logs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielailie committed Nov 10, 2023
1 parent 27948d4 commit 368b1f3
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/modules/marketplaces/marketplaces-reindex.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ export class MarketplacesReindexService {
marketplaceReindexStates,
processInNextBatch.concat(batch),
);

await this.addInactiveStateItemsToDb(marketplaceReindexStates);
console.log({
auctions: marketplaceReindexStates[0].auctions.length,
orders: marketplaceReindexStates[0].orders.length,
offers: marketplaceReindexStates[0].offers.length,
});
// await this.addInactiveStateItemsToDb(marketplaceReindexStates);
} while (input.beforeTimestamp ? afterTimestamp < input.beforeTimestamp : true);

const isFinalBatch = true;
Expand Down Expand Up @@ -402,6 +406,15 @@ export class MarketplacesReindexService {
0,
];
}
if (!paymentTokenIdentifier) {
return [
new Token({
identifier: mxConfig.egld,
decimals: mxConfig.decimals,
}),
paymentNonce,
];
}
const paymentToken = await this.usdPriceService.getToken(paymentTokenIdentifier);
if (!paymentToken) {
return [
Expand All @@ -420,13 +433,20 @@ export class MarketplacesReindexService {

private async addInactiveStateItemsToDb(marketplaceReindexStates: MarketplaceReindexState[], isFinalBatch?: boolean): Promise<void> {
try {
console.log('save to db');
for (const marketplaceReindexState of marketplaceReindexStates) {
marketplaceReindexState.setStateItemsToExpiredIfOlderThanTimestamp(DateUtils.getCurrentTimestamp());

let [inactiveAuctions, inactiveOrders, inactiveOffers] = isFinalBatch
? marketplaceReindexState.popAllItems()
: marketplaceReindexState.popInactiveItems();

console.log({
inactiveOrders: inactiveOrders.length,
inactiveAuctions: inactiveAuctions.length,
inactiveOffers: inactiveOffers.length,
});

if (inactiveAuctions.length === 0 && inactiveOffers.length === 0) {
continue;
}
Expand Down Expand Up @@ -497,6 +517,7 @@ export class MarketplacesReindexService {
delete o.id;
}
});
console.log({ orders: inactiveOrders.length, auctions: inactiveAuctions.length, offers: inactiveOffers.length });

await Promise.all([
saveTagsPromise,
Expand Down

0 comments on commit 368b1f3

Please sign in to comment.