Skip to content

Conversation

@yunlong098
Copy link
Contributor

Reviewed, transaction id: 56558

变更点(Changes)

  • xxxx

相关issues (Which issues this PR fixes)

  • Fixes #

备注(Special notes)

# Reviewed, transaction id: 56558
crontab(minute=minute, hour=hour),
permission_expire_remind.s(tenant_id),
name=f"periodic_permission_expire_remind_{tenant_id}",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前注释掉的原因是:存在顺序问题,比如执行 python manage.py xxx 相关命令时,该函数会由于加载文件而被触发,导致报错异常等问题;

原先的设计是想由于该周期任务并不是固定周期,而是从 DB 里读取执行周期后"下发",但错误使用 celery 的 on_after_finalize 信号,导致加载时被触发;正常这类任务应该是初始化一次即可

正确做法应该是
(1) permission_expire_remind 移动到 apps/tenant 的 tasks 模块下
(2)tenant 模块提供 django command 命令,初始化每个租户的通知任务(实际上就是 执行每个租户的 update_periodic_permission_expire_remind_schedule )

@yunlong098 yunlong098 force-pushed the fix_notifications_not_sent branch from 1236ac4 to 2ea302a Compare September 30, 2025 10:22
# Reviewed, transaction id: 59749
@yunlong098 yunlong098 force-pushed the fix_notifications_not_sent branch from 05a89e5 to 8410b8a Compare September 30, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants