Skip to content

Commit 411635a

Browse files
committed
fix: ignore error from saveFn and reset newItems to avoid retrying failed assets
1 parent 5fae6af commit 411635a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

internal/assets/cache/collection.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ func (c *Collection[T]) addID(id string) bool {
129129
added = true
130130
c.newItems.Add(id)
131131
if c.newItems.Len() >= c.maxCacheSize {
132-
var err error
133-
c.collection, err = c.saveFn(c.collection, c.newItems.Items())
134-
if err == nil {
135-
c.newItems = syncset.New[string]()
136-
}
132+
// err is ignored because it's logged in the saveFn
133+
c.collection, _ = c.saveFn(c.collection, c.newItems.Items())
134+
135+
// a fresh set of assets, even if the save failed, to avoid retrying the same assets
136+
c.newItems = syncset.New[string]()
137137
}
138138
}
139139
return added

0 commit comments

Comments
 (0)