feat(key-pool): add LRU sorting via last_used_at column
- Add migration to add last_used_at TIMESTAMPTZ column to provider_keys - Update select_best_key() SQL to sort by last_used_at ASC NULLS FIRST - Update record_key_usage() to set last_used_at = NOW() on each use - Bump SCHEMA_VERSION to 10
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
-- 20260401000001_provider_keys_last_used.sql
|
||||
-- Key Pool LRU: 记录每个 key 最后使用时间
|
||||
ALTER TABLE provider_keys ADD COLUMN IF NOT EXISTS last_used_at TIMESTAMPTZ;
|
||||
Reference in New Issue
Block a user