chore: fix twt hash

This commit is contained in:
xuu committed 2025-03-30 21:14:11 -06:00
1 parent fb957ed25d
commit fc762f3bf3
4 files changed
+16 -105

No files matched your search

+9 -4
View File
@@ -145,7 +145,7 @@ func httpServer(ctx context.Context, app *appState) error {
return
}
mention := urlNS.UUID5(uri).MarshalText()
mention := urlNS.UUID5(uri)
args := make([]any, 0, 3)
args = append(args, mention)
@@ -163,9 +163,9 @@ func httpServer(ctx context.Context, app *appState) error {
var end int64
err = db.QueryRowContext(ctx, `
select count(*) n from twts, json_each(mentions) where value = ?`, args...).Scan(&end)
select count(*) n from twt_mentions where feed_id = ?`, args...).Scan(&end)
span.RecordError(err)
fmt.Println(mention, end, err)
fmt.Println(mention.MarshalText(), end, err)
if offset < 1 {
offset += end
@@ -191,7 +191,7 @@ func httpServer(ctx context.Context, app *appState) error {
) using (feed_id)
where rowid in (
select rowid from twts
where ulid in (select ulid from twts, json_each(mentions) where value = ?)
where ulid in (select ulid from twt_mentions where feed_id = ?)
order by ulid asc
limit ?
offset ?
@@ -231,6 +231,11 @@ func httpServer(ctx context.Context, app *appState) error {
twt, _ := lextwt.ParseLine(o.Text, &twter)
twts = append(twts, twt)
}
if err := rows.Err(); err != nil {
fmt.Println(err)
return
}
preamble := add(PREAMBLE_DOCS, "twt range = 1 %d", end)
preamble = add(preamble, "self = %s/mentions%s", hostname, mkqry(uri, limit, offset))
if next := offset + int64(len(twts)); next < end {