Skip to content

Commit

Permalink
Merge pull request #949 from multiversx/SERVICES-1085-fix-big-timestamp
Browse files Browse the repository at this point in the history
SERVICES-1085 fix case when timestamp not spported by DB
  • Loading branch information
johnykes authored Mar 16, 2023
2 parents 8cf8172 + 1af13b3 commit 6e1afd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"elasticMaxBatch": 10000,
"dbBatch": 1000,
"complexityLevel": 200,
"getLogsFromElasticBatchSize": 1000
"getLogsFromElasticBatchSize": 1000,
"dbMaxTimestamp": 2147483647
},
"elasticDictionary": {
"scamInfo": {
Expand Down
10 changes: 9 additions & 1 deletion src/modules/marketplaces/marketplaces-reindex.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,15 @@ export class MarketplacesReindexService {
private async addMarketplaceStateToDb(
marketplaceReindexState: MarketplaceReindexState,
): Promise<void> {
marketplaceReindexState.auctions.map((a) => delete a.id);
marketplaceReindexState.auctions.map((a) => {
delete a.id;
if (a.startDate > constants.dbMaxTimestamp) {
a.startDate = constants.dbMaxTimestamp;
}
if (a.endDate > constants.dbMaxTimestamp) {
a.endDate = constants.dbMaxTimestamp;
}
});
marketplaceReindexState.orders.map((o) => delete o.id);
marketplaceReindexState.offers.map((o) => delete o.id);

Expand Down

0 comments on commit 6e1afd5

Please sign in to comment.