chore: adjust timing

This commit is contained in:
xuu 2025-03-29 19:48:06 -06:00
parent dab5a115cf
commit 07aba6d14a
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
3 changed files with 18 additions and 18 deletions

16
feed.go
View File

@ -95,12 +95,12 @@ var (
}
return `
insert into twts (
feed_id,
ulid,
text,
hash,
conv,
mentions,
feed_id,
ulid,
text,
hash,
conv,
mentions,
tags
)
values (?, ?, ?, ?, ?, ?, ?)` + repeat + `
@ -243,7 +243,7 @@ func storeFeed(ctx context.Context, db db, f types.TwtFile) error {
continue
}
nick = strings.TrimSpace(nick)
uri = "http" + strings.TrimSpace(uri)
uri = strings.TrimSpace(uri)
if _, err := url.Parse(uri); err != nil {
continue
@ -285,8 +285,8 @@ func storeFeed(ctx context.Context, db db, f types.TwtFile) error {
feedID, // feed_id
twtID, // ulid
fmt.Sprintf("%+l", twt), // text
subjectTag, // conv
twt.Hash(), // hash
subjectTag, // conv
mentions.ToStrList(), // mentions
tags, // tags
)

View File

@ -210,12 +210,12 @@ func httpServer(ctx context.Context, app *appState) error {
preamble = add(preamble, iAmTheWatcher)
preamble = add(preamble, "")
preamble = add(preamble, "range = 1 %d", end)
preamble = add(preamble, "self = /api/plain/twts%s", mkqry(uri, limit, offset))
preamble = add(preamble, "self = /api/plain/twt%s", mkqry(uri, limit, offset))
if next := offset + int64(len(twts)); next < end {
preamble = add(preamble, "next = /api/plain/twts%s", mkqry(uri, limit, next))
preamble = add(preamble, "next = /api/plain/twt%s", mkqry(uri, limit, next))
}
if prev := offset - int64(limit); prev > 0 {
preamble = add(preamble, "prev = /api/plain/twts%s", mkqry(uri, limit, prev))
preamble = add(preamble, "prev = /api/plain/twt%s", mkqry(uri, limit, prev))
}
reg := lextwt.NewTwtRegistry(preamble, twts)

View File

@ -229,31 +229,31 @@ func checkTemp(twts types.Twts) (int, State) {
since_first := -time.Until(twts[0].Created())
since_fifth := -time.Until(twts[4].Created())
if since_first < 2*time.Hour || since_fifth < 8*time.Hour {
if since_first < 24*time.Hour || since_fifth < 32*time.Hour {
return TwoMinutes, "hot"
}
if since_first < 4*time.Hour || since_fifth < 16*time.Hour {
if since_first < 48*time.Hour || since_fifth < 64*time.Hour {
return TenMinutes, "hot"
}
if since_first < 8*time.Hour || since_fifth < 32*time.Hour {
if since_first < 96*time.Hour || since_fifth < 128*time.Hour {
return 2 * TenMinutes, "warm"
}
if since_first < 16*time.Hour || since_fifth < 64*time.Hour {
if since_first < 192*time.Hour || since_fifth < 256*time.Hour {
return 4 * TenMinutes, "warm"
}
if since_first < 24*time.Hour || since_fifth < 128*time.Hour {
if since_first < 384*time.Hour || since_fifth < 512*time.Hour {
return OneDay, "cold"
}
if since_first < 48*time.Hour || since_fifth < 256*time.Hour {
if since_first < 768*time.Hour || since_fifth < 1024*time.Hour {
return 2 * OneDay, "cold"
}
if since_first < 96*time.Hour || since_fifth < 512*time.Hour {
if since_first < 1536*time.Hour || since_fifth < 2048*time.Hour {
return 7 * OneDay, "frozen"
}