Skip to content

Commit

Permalink
fix: Report stale fallback per record
Browse files Browse the repository at this point in the history
  • Loading branch information
creativecreature committed Jun 11, 2024
1 parent ae09ce6 commit 2dd08c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ func distributedBatchFetch[V, T any](c *Client[T], keyFn KeyFn, fetchFn BatchFet
dataSourceResponses, err := fetchFn(ctx, idsToRefresh)
// Incase of an error, we'll proceed with the ones we got from the distributed storage.
if err != nil {
c.reportDistributedStaleFallback()
for i := 0; i < len(stale); i++ {
c.reportDistributedStaleFallback()
}
c.log.Error(fmt.Sprintf("sturdyc: error fetching records from the underlying data source. %v", err))
maps.Copy(stale, fresh)
return stale, nil
Expand Down

0 comments on commit 2dd08c3

Please sign in to comment.