mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
fix: hold the upstream resync until the OpenCode proxy accepts requests (OM-179)
This commit is contained in:
1 parent
9fca96ecea
commit
3e6ebbd1dc
6 files changed
+103
-1
No files matched your search
@@ -3242,6 +3242,24 @@ describe('OpenCodeServerManager - server auth', () => {
|
||||
expect(manager.isRestartPending()).toBe(false)
|
||||
})
|
||||
|
||||
it('notifies lifecycle listeners only when the gate opens', async () => {
|
||||
const { OpenCodeServerManager } = await import('../../src/services/opencode-single-server')
|
||||
const manager = OpenCodeServerManager.getInstance()
|
||||
const listener = vi.fn()
|
||||
const unsubscribe = manager.onLifecycleInitialized(listener)
|
||||
|
||||
manager.setLifecycleInitialized(false)
|
||||
manager.setLifecycleInitialized(true)
|
||||
manager.setLifecycleInitialized(true)
|
||||
manager.setLifecycleInitialized(false)
|
||||
manager.setLifecycleInitialized(true)
|
||||
unsubscribe()
|
||||
manager.setLifecycleInitialized(false)
|
||||
manager.setLifecycleInitialized(true)
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
function setOpenCodeEnv(values: { host: string; password: string }) {
|
||||
Object.defineProperty(ENV.OPENCODE, 'HOST', { value: values.host, configurable: true, writable: true })
|
||||
Object.defineProperty(ENV.OPENCODE, 'SERVER_PASSWORD', { value: values.password, configurable: true, writable: true })
|
||||
|
||||
Reference in new issue
Block a user