Skip to content

Commit 20ce656

Browse files
committed
fix: fixed initialization server
1 parent ec408f0 commit 20ce656

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/http/validators/validators.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export class ValidatorsService {
2323
return acc;
2424
}, {} as Record<string, string>);
2525

26+
if (!lastUpdatedAt) {
27+
return null;
28+
}
29+
2630
return {
2731
lastUpdatedAt,
2832
maxExitEpoch,

src/jobs/validators/validators.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export class ValidatorsService {
8888
this.validatorsStorageService.setActiveValidatorsCount(activeValidatorCount);
8989
this.validatorsStorageService.setTotalValidatorsCount(data.length);
9090
this.validatorsStorageService.setMaxExitEpoch(latestEpoch);
91-
this.validatorsStorageService.setLastUpdate(Math.floor(Date.now() / 1000));
9291

9392
const frameBalances = await this.getLidoValidatorsWithdrawableBalances(data);
9493
this.validatorsStorageService.setFrameBalances(frameBalances);
@@ -111,6 +110,8 @@ export class ValidatorsService {
111110
})
112111
.inc();
113112
});
113+
114+
this.validatorsStorageService.setLastUpdate(Math.floor(Date.now() / 1000));
114115
},
115116
);
116117
}

src/storage/validators/validators-cache.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export class ValidatorsCacheService {
5252

5353
this.validatorsStorage.setActiveValidatorsCount(Number(data[0]));
5454
this.validatorsStorage.setMaxExitEpoch(data[1]);
55-
this.validatorsStorage.setLastUpdate(Number(data[2]));
5655
this.validatorsStorage.setFrameBalances(this.parseFrameBalances(data[3]));
56+
this.validatorsStorage.setLastUpdate(Number(data[2]));
5757

5858
this.logger.log(`success initialize from cache file ${cacheFileName}`, {
5959
service: ValidatorsCacheService.SERVICE_LOG_NAME,

0 commit comments

Comments
 (0)