mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 23:07:18 +00:00
feat: client affinity reverse index and balanced scheduling
- Separate clientAffinityTTL (24h) from stickySessionTTL (1h) - Atomic Lua dual-write for forward (client→accounts) and reverse (account→clients) affinity indexes with lazy expiry cleanup - Extract Lua scripts to standalone .lua files with //go:embed - Add filterByMinAffinityCount to Layer 1 & 2 scheduling so new clients are routed to accounts with fewest existing affinities - Skip Redis query when no affinity-enabled accounts exist (zero overhead for non-affinity users) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
fbdba40f59
commit
d707c1f93f
13 files changed
+195
-46
No files matched your search
@@ -106,6 +106,9 @@ func (c StubGatewayCache) UpdateClientAffinity(_ context.Context, _ int64, _ str
|
||||
func (c StubGatewayCache) RemoveClientAffinity(_ context.Context, _ int64, _ string, _ int64) error {
|
||||
return nil
|
||||
}
|
||||
func (c StubGatewayCache) GetAccountAffinityCountBatch(_ context.Context, _ int64, _ []int64, _ time.Duration) (map[int64]int64, error) {
|
||||
return map[int64]int64{}, nil
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// StubSessionLimitCache — service.SessionLimitCache 的空实现
|
||||
|
||||
Reference in new issue
Block a user