chore: fixes

This commit is contained in:
xuu
2025-03-31 10:49:36 -06:00
parent aedc9245e5
commit 69755e14d2
5 changed files with 35 additions and 36 deletions

14
feed.go
View File

@@ -432,7 +432,7 @@ func storeRegistry(ctx context.Context, db db, in io.Reader) error {
)
if len(args) >= 16*1022 {
i+=len(args)
i += len(args)
fmt.Println("store", i/7, i)
tx, err := db.BeginTx(ctx, nil)
if err != nil {
@@ -563,7 +563,7 @@ func (n TwtTime) Value() (driver.Value, error) {
}
func makeULID(twt types.Twt) ulid.ULID {
text := fmt.Appendf(nil, "%s\t%+l", cmp.Or(twt.Twter().HashingURI, twt.Twter().URI), twt)
text := fmt.Appendf(nil, "%s\t%+l", twt.Twter().URI, twt)
u := ulid.ULID{}
u.SetTime(ulid.Timestamp(twt.Created()))
u.SetEntropy(sha3.SumSHAKE128(text, 10))
@@ -608,14 +608,18 @@ func refreshLastTwt(ctx context.Context, db db) error {
qry := `
delete from last_twt_on;
insert into last_twt_on
select
select distinct
feed_id,
max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, ' ')-1)))) last_twt_on
from twts
group by feed_id
on conflict(feed_id) do update set last_twt_on = excluded.last_twt_on;
on conflict(feed_id);
delete from twt_mentions;
insert into twt_mentions select ulid, unhex(replace(trim(value,'{}'),'-','')) feed_id from twts, json_each(mentions);
insert into twt_mentions
select distinct
ulid,
unhex(replace(trim(value,'{}'),'-','')) feed_id
from twts, json_each(mentions);
`
var err error
for _, stmt := range strings.Split(qry, ";") {