Skip to content

Commit

Permalink
✨feature: 重构代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeky committed Jun 18, 2023
1 parent 15dc22e commit 57d4b9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dbma/components/mysql/backends/clears.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ClearTask(object):

path: Path

@property
def rename_at(self):
"""根据目录名,计算出目录备份的时间点"""
# 目录的后缀是 “2023-05-29T20-23-32-472128” 这个格式,也就是说它不是一个正确的时间日期格式
Expand All @@ -60,7 +61,7 @@ def is_expired(self, now=None):
# 用传好格式构造 datetime 对象
if match:
now = datetime.now() if now is None else now
delta = now - self.rename_at()
delta = now - self.rename_at
if delta.days >= 3:
return True
# 没有匹配到正则、或是没有超过 3 天
Expand Down

0 comments on commit 57d4b9b

Please sign in to comment.