flan/test/programs/dev-fix-retry.flan

20 lines
610 B
Plaintext

;;;; Fix and retry, from a script: [f] errors, a client loads a new [f] and
;;;; takes [retry] at once, and the retry must run the new body. The load is a
;;;; job in the agent's ring and the restart a choice; the break loop runs what
;;;; was queued before the choice was accepted, then takes it.
(import agent "vendor:agent")
(defstruct Boom [why i32])
(defn f [] i32 (error (Boom {.why 3})) 1)
(defn g [] i32
(restart-case (f)
(retry [] (g))))
(defn main [] i32
(agent/start "/tmp/flan-dev-fix-retry-fallback.sock")
(let [r (g)] (println "RESULT " r))
(dotimes [i 4000] (agent/wait 5))
0)