add error handling to updateCache for saved-feeds (#878)
This commit is contained in:
parent
c060cd4158
commit
71af9fd04b
1 changed files with 19 additions and 9 deletions
|
@ -78,17 +78,27 @@ export class SavedFeedsModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// early exit if no feeds need to be fetched
|
||||||
|
if (!neededFeedUris.length || neededFeedUris.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// fetch the missing models
|
// fetch the missing models
|
||||||
for (let i = 0; i < neededFeedUris.length; i += 25) {
|
try {
|
||||||
const res = await this.rootStore.agent.app.bsky.feed.getFeedGenerators({
|
for (let i = 0; i < neededFeedUris.length; i += 25) {
|
||||||
feeds: neededFeedUris.slice(i, 25),
|
const res = await this.rootStore.agent.app.bsky.feed.getFeedGenerators({
|
||||||
})
|
feeds: neededFeedUris.slice(i, 25),
|
||||||
for (const feedInfo of res.data.feeds) {
|
})
|
||||||
newFeedModels[feedInfo.uri] = new CustomFeedModel(
|
for (const feedInfo of res.data.feeds) {
|
||||||
this.rootStore,
|
newFeedModels[feedInfo.uri] = new CustomFeedModel(
|
||||||
feedInfo,
|
this.rootStore,
|
||||||
)
|
feedInfo,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch feed models', error)
|
||||||
|
this.rootStore.log.error('Failed to fetch feed models', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge into the cache
|
// merge into the cache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue