Skip to content

Commit

Permalink
feat: callback fires only once, remove extra first
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinWoetzel committed Apr 18, 2024
1 parent 431d547 commit ccee193
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/contracts/services/batchQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ const batchQuerySingleBatch$ = ({
&& response.batch.block_height < minBlockHeightValidationOptions.minBlockHeight
) {
// callback for when stale node is detected. Useful for error logging.
if (typeof minBlockHeightValidationOptions.onStaleNodeDetected === 'function') {
// check the retryCount to ensure that this only fires one time
if (retryCount === 0
&& typeof minBlockHeightValidationOptions.onStaleNodeDetected === 'function') {
minBlockHeightValidationOptions.onStaleNodeDetected();
}
return throwError(() => new Error('Stale node detected'));
}
return of(response);
}),
map(parseBatchQuery),
first(),
)),
first(),
catchError((error, caught) => {
Expand Down

0 comments on commit ccee193

Please sign in to comment.