Merge pull request #384 from obdagli/fix/grok-async-initial-usage-sync

fix(grok): avoid blocking the first request on initial usage sync
This commit is contained in:
何夕2077 2026-03-16 10:53:19 +08:00 committed by GitHub
commit b37ead525c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,8 +155,11 @@ export class GrokApiService {
async initialize() { async initialize() {
if (this.isInitialized) return; if (this.isInitialized) return;
try { await this.getUsageLimits(); } catch (error) { logger.warn('[Grok] Initial usage sync failed:', error.message); }
this.isInitialized = true; this.isInitialized = true;
this.getUsageLimits()
.catch((error) => {
logger.warn('[Grok] Initial usage sync failed:', error.message);
});
} }
async refreshToken() { async refreshToken() {