def Fin.cleaned

bend-kube-runtime@0.2.0.0 · src/helpers.bend:38

import bend-kube-runtime@0.2.0.0/src/helpers.bend as Helpers
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J
import bend-kube-runtime@0.2.0.0/src/core.bend as C
import bend-kube-runtime@0.2.0.0/src/config.bend as K
import bend-kube-runtime@0.2.0.0/src/client.bend as Cl
import bend-kube-runtime@0.2.0.0/src/queue.bend as Q

38# After a cleanup: a failed one keeps the finalizer (and retries); a
39# finished one removes it, through a patch that tests it is still ours.
40def Fin.cleaned(+cfg: K.Config, api: C.Api, name: String, patch: J.Json, a: Q.Action) -> IO(Q.Action):
41  match a:
42    case Q.Retry{m}:
43      IO.pure(Q.Action, Q.Retry{m})
44    case +x:
45      IO.bind(Result<&2, &2, Cl.KErr, J.Json>, Q.Action, Cl.Client.patch(cfg, api, name, C.PJson{}, patch),
46        r => Fin.removed(x, r))

Uses (13)

Used by (1)