From 07aba6d14af0dc14997fb9b82aa08b03255d47ca Mon Sep 17 00:00:00 2001 From: xuu Date: Sat, 29 Mar 2025 19:48:06 -0600 Subject: [PATCH] chore: adjust timing --- feed.go | 16 ++++++++-------- http.go | 6 +++--- refresh-loop.go | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/feed.go b/feed.go index baf03bb..71118eb 100644 --- a/feed.go +++ b/feed.go @@ -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 ) diff --git a/http.go b/http.go index 995021c..23bdbc1 100644 --- a/http.go +++ b/http.go @@ -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) diff --git a/refresh-loop.go b/refresh-loop.go index 3e9c3ed..e59a099 100644 --- a/refresh-loop.go +++ b/refresh-loop.go @@ -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" }