diff options
author | FChannel <=> | 2021-01-18 15:07:45 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-18 15:07:45 -0800 |
commit | 328eff4285c94d3840659c04921d7c8048ea1f55 (patch) | |
tree | b69a3bfaf663117b575a867165988c24d6c7b5a4 /outboxGet.go | |
parent | 02e5d46ed214d0efbc3fc566dea7f10415e3fadf (diff) |
too many remote requests, tried to mitigate for getting post counts
Diffstat (limited to 'outboxGet.go')
-rw-r--r-- | outboxGet.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/outboxGet.go b/outboxGet.go index 665ca05..1065ad9 100644 --- a/outboxGet.go +++ b/outboxGet.go @@ -68,10 +68,15 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { post.InReplyTo = GetInReplyToDB(db, post) - post.Replies = GetObjectRepliesDB(db, post) + var postCnt int + var imgCnt int + post.Replies, postCnt, imgCnt = GetObjectRepliesDB(db, post) post.Replies.TotalItems, post.Replies.TotalImgs = GetObjectRepliesDBCount(db, post) + post.Replies.TotalItems = post.Replies.TotalItems + postCnt + post.Replies.TotalImgs = post.Replies.TotalImgs + imgCnt + post.Attachment = GetObjectAttachment(db, attachID) post.Preview = GetObjectPreview(db, previewID) @@ -108,10 +113,16 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ CheckError(err, "error scan object into post struct from path") - post.Replies = GetObjectRepliesDB(db, post) + + var postCnt int + var imgCnt int + post.Replies, postCnt, imgCnt = GetObjectRepliesDB(db, post) post.Replies.TotalItems, post.Replies.TotalImgs = GetObjectRepliesDBCount(db, post) + post.Replies.TotalItems = post.Replies.TotalItems + postCnt + post.Replies.TotalImgs = post.Replies.TotalImgs + imgCnt + post.Attachment = GetObjectAttachment(db, attachID) post.Preview = GetObjectPreview(db, previewID) |