| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as Schedule from "effect/Schedule"; |
| 3 | import type { DockerImagePublicationError } from "../../Docker/RegistryError.ts"; |
| 4 | |
| 5 | export const retryContainerPublication = <A, R>( |
| 6 | publication: Effect.Effect<A, DockerImagePublicationError, R>, |
| 7 | ) => |
| 8 | Effect.retry(publication, { |
| 9 | while: (error) => |
| 10 | error._tag === "DockerRegistryBlobUnknown" || |
| 11 | error._tag === "DockerRegistryUnavailable", |
| 12 | schedule: Schedule.max([Schedule.spaced("3 seconds"), Schedule.recurs(5)]), |
| 13 | }); |