From 3dfc3400da6061c2771ce9ebf719fd09103a0b83 Mon Sep 17 00:00:00 2001 From: Rongrong Date: Tue, 5 Nov 2024 03:48:58 +0800 Subject: [PATCH] fix(web.utils): WebFeed: TypeError Signed-off-by: Rongrong --- src/web/utils.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/web/utils.py b/src/web/utils.py index 5814da00a2..5831d86cb4 100644 --- a/src/web/utils.py +++ b/src/web/utils.py @@ -230,12 +230,10 @@ def calc_next_check_as_per_server_side_cache(self) -> Optional[datetime]: # defer next check as per Cloudflare cache # https://developers.cloudflare.com/cache/concepts/cache-responses/ # https://developers.cloudflare.com/cache/how-to/edge-browser-cache-ttl/ - if ( - self.headers.get('cf-cache-status') in {'HIT', 'MISS', 'EXPIRED', 'REVALIDATED'} - and - wr.expires > now - ): - return wr.expires + if self.headers.get('cf-cache-status') in {'HIT', 'MISS', 'EXPIRED', 'REVALIDATED'}: + expires = wr.expires + if expires and expires > now: + return expires # defer next check as per RSSHub TTL (or Cache-Control max-age) # only apply when TTL > 5min,