aboutsummaryrefslogtreecommitdiff
path: root/outboxGet.go
diff options
context:
space:
mode:
authorFChannel <=>2021-01-18 15:07:45 -0800
committerFChannel <=>2021-01-18 15:07:45 -0800
commit328eff4285c94d3840659c04921d7c8048ea1f55 (patch)
treeb69a3bfaf663117b575a867165988c24d6c7b5a4 /outboxGet.go
parent02e5d46ed214d0efbc3fc566dea7f10415e3fadf (diff)
too many remote requests, tried to mitigate for getting post counts
Diffstat (limited to 'outboxGet.go')
-rw-r--r--outboxGet.go15
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)