From 583a2e803d9a2a18207ba09e661ce2643b1535b2 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 25 Dec 2022 13:49:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=AB=99=E7=82=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=BF=87=E7=A8=8B=E4=B8=AD=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E9=87=8D=E5=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/sites/sites.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/sites/sites.py b/app/sites/sites.py index d909a0e1b..ca3cb6e6e 100644 --- a/app/sites/sites.py +++ b/app/sites/sites.py @@ -171,17 +171,18 @@ def __refresh_all_site_data(self, force=False, specify_sites=None): if not self._sites: return - if not force \ - and not specify_sites \ - and self._last_update_time \ - and (datetime.now() - self._last_update_time).seconds < 6 * 3600: - return + with lock: - if specify_sites \ - and not isinstance(specify_sites, list): - specify_sites = [specify_sites] + if not force \ + and not specify_sites \ + and self._last_update_time \ + and (datetime.now() - self._last_update_time).seconds < 6 * 3600: + return + + if specify_sites \ + and not isinstance(specify_sites, list): + specify_sites = [specify_sites] - with lock: # 没有指定站点,默认使用全部站点 if not specify_sites: refresh_sites = self.get_sites(statistic=True) @@ -204,12 +205,11 @@ def __refresh_all_site_data(self, force=False, specify_sites=None): self.dbhelper.update_site_favicon(site_user_infos) # 实时做种信息 self.dbhelper.update_site_seed_info(site_user_infos) + # 站点图标重新加载 + self.__init_favicons() - # 更新时间 - self._last_update_time = datetime.now() - - # 站点图标重新加载 - self.__init_favicons() + # 更新时间 + self._last_update_time = datetime.now() def __refresh_site_data(self, site_info): """