2026-04-14 20:13:59 +08:00
|
|
|
/**
|
2026-04-29 22:48:39 +08:00
|
|
|
* Usage request scheduler.
|
2026-04-14 20:13:59 +08:00
|
|
|
*
|
2026-04-29 22:48:39 +08:00
|
|
|
* All platforms execute immediately without queuing — the backend uses
|
|
|
|
|
* passive sampling so upstream 429 rate-limit errors are no longer a concern.
|
2026-04-14 20:13:59 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import type { Account } from '@/types'
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-29 22:48:39 +08:00
|
|
|
* Schedule a usage fetch. All requests execute immediately.
|
2026-04-14 20:13:59 +08:00
|
|
|
*/
|
|
|
|
|
export function enqueueUsageRequest<T>(
|
2026-04-29 22:48:39 +08:00
|
|
|
_account: Account,
|
2026-04-14 20:13:59 +08:00
|
|
|
fn: () => Promise<T>
|
|
|
|
|
): Promise<T> {
|
2026-04-29 22:48:39 +08:00
|
|
|
return fn()
|
2026-04-14 20:13:59 +08:00
|
|
|
}
|