Skip to content

CheckpointService

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/packages/doc-automation/src/v2/pipeline/checkpoint.ts

Methods

MethodSignatureReturns
savesave(jobState: JobState, stageData: Record<string, unknown>)Promise<string>
loadload(jobId: string)`Promise<CheckpointData
existsexists(jobId: string)Promise<boolean>
deletedelete(jobId: string)Promise<void>
startAutoSavestartAutoSave(getState: () => { jobState: JobState; stageData: Record<string, unknown> })void
stopAutoSavestopAutoSave()void
listJobslistJobs()Promise<string[]>
getHistorygetHistory(jobId: string)Promise<{ path: string; timestamp: Date }[]>

Where it refuses work

  • CheckpointService stops the work with an early return when (error as NodeJS.ErrnoException).code === 'ENOENT'.
  • CheckpointService stops the work with an early return when files.length <= this.config.maxCheckpoints.
  • CheckpointService stops the work with an early return when this.config.autoSaveInterval <= 0.

When something fails

  • CheckpointService handles failure in 10 places: it discards it silently in 4, turns it into a return value in 3, lets it reach the caller in 2, and logs it and continues in 1.

Was this page helpful?

Download as PDF
CheckpointService — Atloria (self dogfood)