mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 08:03:33 +00:00
refactor(wsl): keep relay manager within lint budget
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export async function resolveWslHookRelayDefaultDistro(
|
||||
cached: string | null,
|
||||
listDistros: () => Promise<string[]>
|
||||
): Promise<string | null> {
|
||||
if (cached) {
|
||||
return cached
|
||||
}
|
||||
try {
|
||||
return (await listDistros())[0] ?? null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { wireWslRelayLink } from './wsl-hook-relay-link'
|
||||
import { WslRelayRecovery } from './wsl-hook-relay-recovery'
|
||||
import { wslHookRelayStateKey } from './wsl-hook-relay-state-key'
|
||||
import type { WslHookRelayLifecycleState } from './wsl-hook-relay-lifecycle-state'
|
||||
import { resolveWslHookRelayDefaultDistro } from './wsl-hook-relay-default-distro'
|
||||
import { SshChannelMultiplexer, type MultiplexerTransport } from '../ssh/ssh-channel-multiplexer'
|
||||
import { AGENT_HOOK_REQUEST_REPLAY_METHOD } from '../../shared/agent-hook-relay'
|
||||
import {
|
||||
@@ -343,15 +344,9 @@ export class WslHookRelayManager {
|
||||
}
|
||||
|
||||
private async resolveDefaultDistro(): Promise<string | null> {
|
||||
if (this.defaultDistro) {
|
||||
return this.defaultDistro
|
||||
}
|
||||
try {
|
||||
const distros = await this.deps.listDistros()
|
||||
this.defaultDistro = distros[0] ?? null
|
||||
} catch {
|
||||
this.defaultDistro = null
|
||||
}
|
||||
this.defaultDistro = await resolveWslHookRelayDefaultDistro(this.defaultDistro, () =>
|
||||
this.deps.listDistros()
|
||||
)
|
||||
return this.defaultDistro
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user