Skip to content

Commit

Permalink
chore: added better logs
Browse files Browse the repository at this point in the history
  • Loading branch information
troykessler committed Jun 12, 2024
1 parent c4a9fed commit f8ee54d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/protocol/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class Validator {
)
.option(
"--skip-data-availability-check",
"Skip data availability check and join pool instantly without waiting for the data source. WARNING: Only use this if you know what you are doing"
"Skip data availability check and join pool instantly without waiting for the data source. WARNING: Only use this if you know what you are doing since this can lead to timeout slashes"
)
.action((options) => {
this.start(options);
Expand Down
8 changes: 6 additions & 2 deletions common/protocol/src/methods/checks/isDataAvailable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import { Validator, standardizeError } from "../..";
* @return {Promise<boolean>}
*/
export async function isDataAvailable(this: Validator): Promise<boolean> {
let nextKey = "";

try {
// log debug method
if (this.pool.data!.current_key) {
this.logger.debug(`this.runtime.nextKey(${this.pool.data!.current_key})`);
}

// get the next key to node has to fetch
const nextKey = this.pool.data!.current_key
nextKey = this.pool.data!.current_key
? await this.runtime.nextKey(this, this.pool.data!.current_key)
: this.pool.data!.start_key;

Expand All @@ -45,7 +47,9 @@ export async function isDataAvailable(this: Validator): Promise<boolean> {

return true;
} catch (err) {
this.logger.warn(`Data not available for next key. Retrying in 60s ...`);
this.logger.warn(
`Data not available for next key ${nextKey}. Retrying in 60s ...`
);
this.logger.warn(standardizeError(err));

return false;
Expand Down

0 comments on commit f8ee54d

Please sign in to comment.