try harder to retrieve threads from the database
Ted Unangst tedu@tedunangst.com
Fri, 08 Mar 2024 02:37:37 -0500
2 files changed,
31 insertions(+),
0 deletions(-)
M
database.go
→
database.go
@@ -293,6 +293,33 @@ }
func gethonksbyconvoy(userid UserID, convoy string, wanted int64) []*Honk { rows, err := stmtHonksByConvoy.Query(wanted, userid, userid, convoy) honks := getsomehonks(rows, err) + seen := make(map[string]bool, len(honks)) + for _, h := range honks { + seen[h.XID] = true + } + var missing []string + for _, h := range honks { + if h.RID != "" && !seen[h.RID] { + missing = append(missing, h.RID) + } + } + for len(missing) > 0 { + dlog.Printf("missing honks: %v", missing) + nextround := missing + missing = nil + for _, xid := range nextround { + seen[xid] = true + } + for _, xid := range nextround { + h := getxonk(userid, xid) + if h != nil { + honks = append(honks, h) + if h.RID != "" && !seen[h.RID] { + missing = append(missing, h.RID) + } + } + } + } return honks } func gethonksbysearch(userid UserID, q string, wanted int64) []*Honk {
M
docs/changelog.txt
→
docs/changelog.txt
@@ -1,5 +1,9 @@
changelog +### next + ++ Try harder to retrieve threads from the database. + ### 1.3.1 Retooled Reticule + Some logging fixes.