Skip to content

Commit

Permalink
修复到期邮件发送失败的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mouday committed Feb 2, 2024
1 parent 381a8ba commit 332ec4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions domain_admin/service/notify_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ def notify_all_event():
触发所有通知事件
:return: int 成功数量
"""
# fix: TypeError: inner() takes 2 positional arguments but 3 were given
rows = NotifyModel.select().where(
NotifyModel.status == True,
NotifyModel.event_id.in_(
NotifyModel.event_id.in_([
EventEnum.SSL_CERT_EXPIRE,
EventEnum.DOMAIN_EXPIRE
)
])
)

success = 0
Expand Down
2 changes: 1 addition & 1 deletion domain_admin/utils/datetime_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def microsecond_for_human(value):
seconds, value = divmod(value, SECOND)
lst.append(str(seconds) + 's')

if value >= 0:
if value > 0:
lst.append(str(value) + 'ms')

return ' '.join(lst)
Expand Down
9 changes: 9 additions & 0 deletions tests/model/domain_info_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ def test_order(self):
).order_by(SQL("`create_time` desc")))

# ('SELECT `t1`.`id`, `t1`.`create_time` FROM `tb_domain_info` AS `t1` ORDER BY `create_time` desc', [])

def test_in(self):
rows = list(DomainInfoModel.select(
DomainInfoModel.id, DomainInfoModel.create_time
).where(
DomainInfoModel.id.in_([1, 2, 3])
))

# ('SELECT `t1`.`id`, `t1`.`create_time` FROM `tb_domain_info` AS `t1` WHERE (`t1`.`id` IN (%s, %s, %s))', [1, 2, 3])

0 comments on commit 332ec4b

Please sign in to comment.