Improve failover startup handling and status UI
Build and Deploy Gateway / build-and-push (push) Successful in 25s
Build and Deploy Gateway / deploy (push) Successful in 6s

This commit is contained in:
2026-08-19 20:24:04 +03:00
parent cedd31cc16
commit 3b515ee355
10 changed files with 190 additions and 63 deletions
@@ -0,0 +1,19 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createSingboxSelectorService } from '../../dist/server/services/singboxSelectorService.js';
test('selector waits for the sing-box API after a fresh process start', async () => {
let attempts = 0;
const service = createSingboxSelectorService({
port: 0,
send: async (method) => {
attempts += 1;
if (attempts < 3) throw Object.assign(new Error('not ready'), { code: 'ECONNREFUSED' });
return method === 'GET' ? { now: 'channel-primary' } : {};
},
});
assert.deepEqual(await service.select('primary'), { role: 'primary' });
assert.equal(attempts, 4);
});