Skip to content

Commit

Permalink
fix(/sub): monitoring not deferred as per server-side cache
Browse files Browse the repository at this point in the history
Since d6aa15c, monitoring tasks will be deferred when aggressive
server-side caches (e.g., Cloudflare and RSSHub, which make it futile to
check for updates before cache expiration) are detected. However, the
first monitoring task for a newly subscribed feed was not being
deferred. This has been fixed and the first monitoring task now waits
for the server-side cache to expire.

Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Nov 4, 2024
1 parent 137281a commit 2313538
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
### Enhancements

- **No longer proxies images from `*.wp.com` when generating Telegraph posts**: `*.wp.com` is in the blocklist of `wsrv.nl` (environment variable `IMAGES_WESERV_NL`). Thus, these images are no longer proxied when generating Telegraph posts. All images from `*.wp.com` can be accessed with any referer header, so they are now kept as is.
- **Minor refactor**: Some internal functions have been refactored to improve performance, readability and maintainability.

### Bug fixes

- **Canonical `DATABASE_URL` not recognized**: Since v2.9.0, `DATABASE_URL` is canonicalized before connecting to the corresponding database. However, a canonical URL pointing to a local path cannot be recognized when checking the validity of the scheme (database type). Both canonical (`scheme:/path/to/file.db`) and traditional (`scheme:///path/to/file.db`) forms of such URLs are recognized correctly now.
- **Monitoring not deferred as per server-side cache when subscribing**: Since v2.7.0, monitoring tasks will be deferred when aggressive server-side caches (e.g., Cloudflare and RSSHub, which make it futile to check for updates before cache expiration) are detected. However, the first monitoring task for a newly subscribed feed was not being deferred. This has been fixed and the first monitoring task now waits for the server-side cache to expire.

## v2.9.0: Telegraph-related revert, skip cert verification, and more

Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
### 增强

- **生成 Telegraph 文章时,不再代理来自 `*.wp.com` 的图像**: `*.wp.com` 位于 `wsrv.nl` (环境变量 `IMAGES_WESERV_NL`) 的阻断列表中。因此,在生成 Telegraph 文章时,这些图像不再被代理。来自 `*.wp.com` 的所有图片都可以用任何 refer 头访问,因此它们现在保持原样。
- **次要的重构**: 重构了一些内部函数以提高性能、可读性和可维护性。

### Bug 修复

- **无法识别规范的 `DATABASE_URL`**: 自 v2.9.0 起, 在连接到相应的数据库之前,`DATABASE_URL` 被规范化。然而,在检查 scheme (数据库类型) 的合法性时,无法识别指向本地路径的规范 URL。现在,此类 URL 的规范 (`scheme:/path/to/file.db`) 和传统 (`scheme:///path/to/file.db`) 形式都被正确识别。
- **订阅时不会根据服务端缓存延迟监控**:自 v2.7.0 起,当检测到激进的服务器端缓存时,监控任务将被延迟(例如 Cloudflare 和 RSSHub,它们使得在缓存过期之前检查更新变得徒劳无功)。但是,当新订阅 feed 时,第一个监视任务不会被推迟。该问题已修复,第一个监控任务会等待服务端缓存过期。

## v2.9.0: 与 Telegraph 相关的 revert、跳过证书校验和更多

Expand Down
2 changes: 1 addition & 1 deletion src/command/inner/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def sub(user_id: int,
if created_new_feed or feed.state == 0:
feed.state = 1
feed.error_count = 0
feed.next_check_time = None
feed.next_check_time = wf.calc_next_check_as_per_server_side_cache()
etag = wr.etag
if etag:
feed.etag = etag
Expand Down

0 comments on commit 2313538

Please sign in to comment.