Skip to content

Commit 4638c6e

Browse files
committed
chore: retry on stream ended
1 parent 3dcd838 commit 4638c6e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/client/create-claim.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ function shouldRetry(err: Error) {
7070
return false
7171
}
7272

73+
// possibly a network error, or the server
74+
// closed the connection before we received the full data
75+
if(err.message?.includes('stream ended before')) {
76+
return true
77+
}
78+
7379
return err instanceof AttestorError
7480
&& err.code !== 'ERROR_INVALID_CLAIM'
7581
&& err.code !== 'ERROR_BAD_REQUEST'

src/client/utils/client-socket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class AttestorClient extends AttestorSocket implements IAttestorClient {
6969
const rslt = this.waitForResponse<T>(msgId, timeoutMs)
7070
await this.sendMessage({ id: msgId, [getRpcRequestType(type)]: request })
7171

72-
return rslt
72+
return await rslt
7373
} finally {
7474
const timeTakenMs = Date.now() - now
7575
this.logger.debug({ type, timeTakenMs }, 'received rpc response')

0 commit comments

Comments
 (0)