Skip to content

Commit

Permalink
fix 站点数据刷新过程中不能触发重刷
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Dec 25, 2022
1 parent 2478d5c commit 583a2e8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions app/sites/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
"""
Expand Down

0 comments on commit 583a2e8

Please sign in to comment.