fix: 修复整合包失败后的完整重试流程
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync LobeHub models / sync (push) Has been cancelled
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync LobeHub models / sync (push) Has been cancelled
This commit is contained in:
1 parent
392f01ea4b
commit
a47d309103
8 files changed
+266
-32
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import type { InstallJobSnapshot } from './install.ts'
|
||||
|
||||
interface InstallRetryDependencies {
|
||||
getInstanceMode: (instanceId: string) => Promise<'starlight' | 'local'>
|
||||
retryHosted: (instanceId: string, sourceJobId: string) => Promise<void>
|
||||
retryGeneric: (jobId: string) => Promise<InstallJobSnapshot>
|
||||
}
|
||||
|
||||
/**
|
||||
* Minecraft installation jobs started by StarLight synchronization are only
|
||||
* one stage of the full operation. Retrying that stage alone leaves the
|
||||
* pending pack journal unapplied, so these jobs must resume through
|
||||
* `hostedSync` instead of the generic install-job retry command.
|
||||
*/
|
||||
export function hostedRuntimeRetryInstanceId(job: InstallJobSnapshot): string | null {
|
||||
if (job.kind !== 'install_existing_instance' || job.instance_deleted) return null
|
||||
return job.instance_id ?? job.target.instance_id ?? null
|
||||
}
|
||||
|
||||
export function hostedRetryRoute(instanceId: string): string {
|
||||
return `/instance/${encodeURIComponent(instanceId)}`
|
||||
}
|
||||
|
||||
export async function retryInstallJob(
|
||||
job: InstallJobSnapshot,
|
||||
dependencies: InstallRetryDependencies,
|
||||
): Promise<InstallJobSnapshot | null> {
|
||||
const instanceId = hostedRuntimeRetryInstanceId(job)
|
||||
if (instanceId && (await dependencies.getInstanceMode(instanceId)) === 'starlight') {
|
||||
await dependencies.retryHosted(instanceId, job.job_id)
|
||||
return null
|
||||
}
|
||||
return dependencies.retryGeneric(job.job_id)
|
||||
}
|
||||
Reference in new issue
Block a user