Skip to content

Commit

Permalink
feat: retry using replica time when receiving ingress expiry error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason I committed Sep 27, 2024
1 parent 21cf470 commit e875f18
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/agent/src/agent/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,16 @@ export class HttpAgent implements Agent {
);
}

if ((error as ReplicaTimeError).message.includes('ingress_expiry')) {
this.log.warn('Agent time out of sync. Updating and retrying...');
this.replicaTime = (error as ReplicaTimeError).replicaTime;
return this.call(
canisterId,
options,
identity,
);
}

this.log.error('Error while making call:', error as Error);
throw error;
}
Expand Down

0 comments on commit e875f18

Please sign in to comment.