({
host,
port,
qwenAPI,
authService,
runtimeConfigStore,
accountRefreshScheduler,
liveLogger,
fileLogger,
config,
}: {
host: string;
port: number;
qwenAPI: any;
authService: any;
runtimeConfigStore: any;
accountRefreshScheduler: any;
liveLogger: any;
fileLogger: any;
config: any;
})
| 106 | } |
| 107 | |
| 108 | export async function initializeServerRuntime({ |
| 109 | host, |
| 110 | port, |
| 111 | qwenAPI, |
| 112 | authService, |
| 113 | runtimeConfigStore, |
| 114 | accountRefreshScheduler, |
| 115 | liveLogger, |
| 116 | fileLogger, |
| 117 | config, |
| 118 | }: { |
| 119 | host: string; |
| 120 | port: number; |
| 121 | qwenAPI: any; |
| 122 | authService: any; |
| 123 | runtimeConfigStore: any; |
| 124 | accountRefreshScheduler: any; |
| 125 | liveLogger: any; |
| 126 | fileLogger: any; |
| 127 | config: any; |
| 128 | }): Promise<void> { |
| 129 | await initializeRuntimeLogging(runtimeConfigStore, fileLogger); |
| 130 | liveLogger.serverStarted(host, port); |
| 131 | qwenAPI.authManager.init(qwenAPI); |
| 132 | fileLogger.startCleanupJob(); |
| 133 | |
| 134 | try { |
| 135 | await logAccountStatus({ qwenAPI, authService, config }); |
| 136 | } catch { |
| 137 | console.log("\x1b[33mWarning: Could not load accounts\x1b[0m"); |
| 138 | } |
| 139 | |
| 140 | try { |
| 141 | await accountRefreshScheduler.initialize(); |
| 142 | } catch (error: any) { |
| 143 | console.log(`\x1b[31mScheduler init failed: ${error.message}\x1b[0m`); |
| 144 | } |
| 145 | } |
no test coverage detected