Skip to content

Commit

Permalink
fix: update log
Browse files Browse the repository at this point in the history
  • Loading branch information
Amuhar committed Sep 4, 2024
1 parent 82d60dd commit ad36618
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
29 changes: 17 additions & 12 deletions src/common/registry-csm/main/abstract-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,27 @@ export abstract class AbstractRegistryService {

const operatorKeys = result.filter((key) => key);

totalKeysAmount += operatorKeys.length;

if (operatorKeys.length > 0) {
this.logger.log('Keys fetched', {
operatorIndex,
fromIndex,
toIndex,
operatorKeys: operatorKeys.length,
fetchedKeys: result.length,
stakingModuleAddress: moduleAddress,
});
const operatorKeysCount = operatorKeys.length;
totalKeysAmount += operatorKeysCount;

await this.saveKeys(operatorKeys);
const logMeta = {
operatorIndex,
fromIndex,
toIndex,
operatorKeys: operatorKeysCount,
fetchedKeys: result.length,
stakingModuleAddress: moduleAddress,
};

if (operatorKeysCount > 0) {
this.logger.log('Keys fetched', logMeta);
await this.saveKeys(operatorKeys);
this.logger.log('Keys saved', { operatorIndex, stakingModuleAddress: moduleAddress });
}

if (operatorKeysCount === 0) {
this.logger.log('No keys fetched', logMeta);
}
}

const updateTimeEnd = performance.now();
Expand Down
30 changes: 18 additions & 12 deletions src/common/registry/main/abstract-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,27 @@ export abstract class AbstractRegistryService {

const operatorKeys = result.filter((key) => key);

totalKeysAmount += operatorKeys.length;

if (operatorKeys.length > 0) {
this.logger.log('Keys fetched', {
operatorIndex,
fromIndex,
toIndex,
operatorKeys: operatorKeys.length,
fetchedKeys: result.length,
stakingModuleAddress: moduleAddress,
});

const operatorKeysCount = operatorKeys.length;
totalKeysAmount += operatorKeysCount;

const logMeta = {
operatorIndex,
fromIndex,
toIndex,
operatorKeys: operatorKeysCount,
fetchedKeys: result.length,
stakingModuleAddress: moduleAddress,
};

if (operatorKeysCount > 0) {
this.logger.log('Keys fetched', logMeta);
await this.saveKeys(operatorKeys);
this.logger.log('Keys saved', { operatorIndex, stakingModuleAddress: moduleAddress });
}

if (operatorKeysCount === 0) {
this.logger.log('No keys fetched', logMeta);
}
}

const updateTimeEnd = performance.now();
Expand Down

0 comments on commit ad36618

Please sign in to comment.