Commit e12dd079 authored by shaw's avatar shaw
Browse files

修复调度器空缓存导致的竞态条件bug

当新分组创建后立即绑定账号时,调度器会错误地将空快照视为有效缓存命中,
导致返回没有可调度的账号。现在空快照会触发数据库回退查询。
parent 269a6592
...@@ -58,7 +58,9 @@ func (c *schedulerCache) GetSnapshot(ctx context.Context, bucket service.Schedul ...@@ -58,7 +58,9 @@ func (c *schedulerCache) GetSnapshot(ctx context.Context, bucket service.Schedul
return nil, false, err return nil, false, err
} }
if len(ids) == 0 { if len(ids) == 0 {
return []*service.Account{}, true, nil // 空快照视为缓存未命中,触发数据库回退查询
// 这解决了新分组创建后立即绑定账号时的竞态条件问题
return nil, false, nil
} }
keys := make([]string, 0, len(ids)) keys := make([]string, 0, len(ids))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment