diff options
| author | Guillermo Serrahima <dev@vylion.com> | 2026-07-16 02:38:46 +0200 |
|---|---|---|
| committer | Guillermo Serrahima <dev@vylion.com> | 2026-07-16 02:38:46 +0200 |
| commit | 53ede6765a1583538b2abc3142d858464b3cf01c (patch) | |
| tree | 422143cbc37098ebe0feb10b581c555e9f600005 /fetchers/app.bsky.feed.go | |
| parent | 2f4f118bb755e92961c1225c49ff30ab4951daff (diff) | |
| download | llostre-main.tar.xz llostre-main.zip | |
Diffstat (limited to 'fetchers/app.bsky.feed.go')
| -rw-r--r-- | fetchers/app.bsky.feed.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fetchers/app.bsky.feed.go b/fetchers/app.bsky.feed.go index a0eaeb2..232d020 100644 --- a/fetchers/app.bsky.feed.go +++ b/fetchers/app.bsky.feed.go @@ -57,6 +57,7 @@ func FetchAppBskyFeedPostsWithCursor(conf *Config, did, pdsURL string, session * } else { notes, err := parseAppBskyFeedPostCollection(conf, session, records, author) conf.Cache.SetCursor(did, nextCursor) + updatePostCount(conf, did, cursor, len(notes)) return notes, err } } @@ -69,9 +70,18 @@ func FetchAppBskyFeedPostsWithCursor(conf *Config, did, pdsURL string, session * notes, err := parseAppBskyFeedPostCollection(conf, session, records, author) conf.Cache.SetCursor(did, nextCursor) + updatePostCount(conf, did, cursor, len(notes)) return notes, err } +func updatePostCount(conf *Config, did, cursor string, fetchedCount int) { + if cursor == "" { + conf.Cache.SetPostCount(did, fetchedCount) + } else { + conf.Cache.AddPostCount(did, fetchedCount) + } +} + func GetAppBskyFeedPostByURI(conf *Config, uri string, session *auth.OAuthState) (*notes.Note, error) { // check cache, return if it was cached without auth or if it was cached with auth and we have auth conf.Logger.Debug("Getting app.bsky.feed.post", "uri", uri) @@ -81,7 +91,8 @@ func GetAppBskyFeedPostByURI(conf *Config, uri string, session *auth.OAuthState) return cached, nil } - // author requires auth - if we have a session, serve it + // author requires auth + // if we have a session, serve it // if the token was invalid, trust that it would have been caught by the "refresh token" call in main if session != nil { return cached, nil |
