mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-05-04 21:20:51 +08:00
Backend: Fix three race conditions in SetSnapshot that caused account scheduling anomalies and broken sticky sessions: - Use Lua CAS script for atomic version activation, preventing version rollback when concurrent goroutines write snapshots simultaneously - Add UnlockBucket to release rebuild lock immediately after completion instead of waiting 30s TTL expiry - Replace immediate DEL of old snapshots with 60s EXPIRE grace period, preventing readers from hitting empty ZRANGE during version switches Frontend: Remove serial queue throttle (1-2s delay per request) from usage loading since backend now uses passive sampling. All usage requests execute immediately in parallel.
19 lines
418 B
TypeScript
19 lines
418 B
TypeScript
/**
|
|
* Usage request scheduler.
|
|
*
|
|
* All platforms execute immediately without queuing — the backend uses
|
|
* passive sampling so upstream 429 rate-limit errors are no longer a concern.
|
|
*/
|
|
|
|
import type { Account } from '@/types'
|
|
|
|
/**
|
|
* Schedule a usage fetch. All requests execute immediately.
|
|
*/
|
|
export function enqueueUsageRequest<T>(
|
|
_account: Account,
|
|
fn: () => Promise<T>
|
|
): Promise<T> {
|
|
return fn()
|
|
}
|