Fork me on GitHub
#re-frame
<
2018-05-01
>
pandeiro05:05:07

Curious if anyone has an approach/example for retrying failed events when using the async flow model

danielneal15:05:48

I've moved on from using async-flow to a state machine model

danielneal15:05:18

For example - I have a sync state machine that looks like this

(def state-machine
  "Sync state machine"
  {nil {:sync/init :ready}
   :ready {:sync/fetch-order :fetching-order}
   :fetching-order {:fetch-order/success-no-client-changes :ready
                    :fetch-order/failure-disconnected :disconnected
                    :fetch-order/failure-token-expired :warning
                    :sync/save-order :saving-order
                    :sync/conflict :warning}
   :warning {:warning/accept :ready}
   :saving-order {:save-order/success-no-changes :ready
                  :save-order/success-more-changes :throttling
                  :save-order/failure-disconnected :disconnected
                  :save-order/failure-token-expired :warning}
   :throttling {:sync/fetch-order :fetching-order}
   :disconnected {:sync/fetch-order :fetching-order}})

danielneal15:05:45

I explicitly keep track of what state I'm in, and retry using a backoff interval

pandeiro16:05:32

Very cool, thanks for the pointer

tees15:05:59

is anybody using any form libraries with re-agent/re-natal/re-frame?

tees15:05:47

ie, some tools that ease and unify form validation, state, spec....

pandeiro16:05:55

Another async-flow solutioning question: say I have 3 async steps, each of which update an object which the next step will need - what are some approaches for passing that data 'through the pipe'?

eoliphant19:05:09

@tees I’ve used free-form and re-frame-forms. They’re both ok, depending on your needs.

eoliphant19:05:18

That’s a good question @pandeiro, i’m not sure, I’d probably just stick the ‘intermediate results’ in the db, but of course, you probably can’t guarantee that something else doesn’t muck with it

djwhitt22:05:38

@pandeiro You might want to check out kee-frame event chaining: https://github.com/ingesolvoll/kee-frame#event-chains

👍 4
mikethompson23:05:49

@pandeiro there is a PR for this in re-frame-async-flow repo which is, as yet, unapplied by me