fix(tenants): 停用租户不停运行时——status 只在 switch_tenant 一处生效,已签发会话/调度/挂起 resume 全部不受影响
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python, redis, sqlite
- Domain
- authentication, backend, distributed-systems
Research direction
Start with tenants_svc.py:set_tenant_status, users_svc.py:resolve_session and switch_tenant, auth.py, schedule_service.py:fire_schedule, and the worker _dispatch_task entry point. Trace how tenant status is read across sessions, schedule dispatch, and resume handling; done means signed sessions receive 403 after deactivation and the tenant's schedules are no longer enqueued.
Written by the indexing model from the issue text.
Description
场景 gap 单(okguitar 提报)· 优先级 P1 · 依赖:无
基线 HEAD = ddcedae。
Summary
tenants_svc.py:85-93 set_tenant_status 只改 SQLite 行。全仓唯一检查点是 users_svc.py:234-235(switch_tenant 内 tenant.status != "active" 拦截)。三个运行面都不查:
users_svc.py:186-221resolve_session不查 Tenant.status——已签发的 7 天会话在租户停用后继续全权访问;auth.py:53-117同样不查;server/services/schedule_service.py:80-108fire_schedule从 Redis HASH 派发,不查租户状态——停用租户的 cron 继续入队执行;- worker 恢复挂起执行也无租户状态闸。
影响
「停用租户」对运行面是 no-op:封禁/欠费租户的已登录用户继续读写数据、调度继续跑、挂起 run 继续 resume——只影响下次手动切换租户。
建议
resolve_session、worker _dispatch_task、fire_schedule 三处加租户状态闸(worker 可缓存租户状态于 Redis 短 TTL);停用时批量撤销该租户会话并禁用其 schedules。
验收:停用租户后,其已签发会话的 API 调用返回 403;其 schedule 不再入队。
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- Avg merge
- 3h 53m
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jeffkit/plaita
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
MystenLabs/MemWal#1163 · 2 comments ·
Maintainers usually reply within 1 day
-
infertopics leaves new nodes without a topic when untopiced neighbours outnumber topiced onesPossibly taken @moneebullah25 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ClanGenOfficial/clangen#6254 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FinanceFlash/unvibecode#218 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day