Commit 0a37c05
Eric Bower
·
2025-08-08 22:19:21 -0400 EDT
parent d32eeb3
fix(feeds): remove references to `digest_interval`
4 files changed,
+7,
-6
+1,
-1
| ... | ... | @@ -95,7 +95,7 @@ Create a blogs.txt file: | |
| 95 | 95 | ||
| 96 | 96 | ``` | |
| 97 | 97 | =: email rss@myemail.com | |
| 98 | - | =: digest_interval 1day | |
| 98 | + | =: cron 0 13 * * * | |
| 99 | 99 | => https://pico.prose.sh/rss | |
| 100 | 100 | => https://erock.prose.sh/rss | |
| 101 | 101 | ``` |
+1,
-1
| ... | ... | @@ -542,7 +542,7 @@ func AddPlusFeedForUser(dbpool db.DB, userID, email string) error { | |
| 542 | 542 | ||
| 543 | 543 | href := fmt.Sprintf("https://auth.pico.sh/rss/%s", token) | |
| 544 | 544 | text := fmt.Sprintf(`=: email %s | |
| 545 | - | =: digest_interval 10min | |
| 545 | + | =: cron */10 * * * * | |
| 546 | 546 | =: inline_content true | |
| 547 | 547 | => %s | |
| 548 | 548 | => https://blog.pico.sh/rss`, email, href) |
+1,
-1
| ... | ... | @@ -62,7 +62,7 @@ func TestPaymentWebhook(t *testing.T) { | |
| 62 | 62 | continue | |
| 63 | 63 | } | |
| 64 | 64 | expectedText := `=: email auth@pico.test | |
| 65 | - | =: digest_interval 10min | |
| 65 | + | =: cron */10 * * * * | |
| 66 | 66 | =: inline_content true | |
| 67 | 67 | => https://auth.pico.sh/rss/123 | |
| 68 | 68 | => https://blog.pico.sh/rss` |
+4,
-3
| ... | ... | @@ -154,7 +154,7 @@ func DateToMin(now time.Time) time.Time { | |
| 154 | 154 | ) | |
| 155 | 155 | } | |
| 156 | 156 | ||
| 157 | - | func (f *Fetcher) Validate(post *db.Post, parsed *shared.ListParsedText, now time.Time) error { | |
| 157 | + | func (f *Fetcher) Validate(logger *slog.Logger, post *db.Post, parsed *shared.ListParsedText, now time.Time) error { | |
| 158 | 158 | expiresAt := post.ExpiresAt | |
| 159 | 159 | if expiresAt != nil { | |
| 160 | 160 | if post.ExpiresAt.Before(now) { |
| ... | ... | @@ -167,6 +167,7 @@ func (f *Fetcher) Validate(post *db.Post, parsed *shared.ListParsedText, now tim | |
| 167 | 167 | if parsed.DigestInterval != "" { | |
| 168 | 168 | cron = DigestIntervalToCron(parsed.DigestInterval) | |
| 169 | 169 | } | |
| 170 | + | logger.Info("found cron", "cron", cron) | |
| 170 | 171 | ||
| 171 | 172 | if !f.gron.IsValid(cron) { | |
| 172 | 173 | return fmt.Errorf("(%s) is invalid `cron`, skipping", cron) |
| ... | ... | @@ -202,8 +203,8 @@ func (f *Fetcher) RunPost(logger *slog.Logger, user *db.User, post *db.Post, ski | |
| 202 | 203 | } | |
| 203 | 204 | } | |
| 204 | 205 | ||
| 205 | - | logger.Info("last digest", "timestamp", post.Data.LastDigest.Format(time.RFC3339)) | |
| 206 | - | err := f.Validate(post, parsed, now) | |
| 206 | + | logger.Info("last digest", "at", post.Data.LastDigest.Format(time.RFC3339)) | |
| 207 | + | err := f.Validate(logger, post, parsed, now) | |
| 207 | 208 | if err != nil { | |
| 208 | 209 | logger.Info("validation failed", "err", err) | |
| 209 | 210 | if skipValidation { |