-
Notifications
You must be signed in to change notification settings - Fork 267
Refactor Nucleus and Zome Calls to pure reducers #991
Conversation
Looking good! I just renabled the call_test_assigned test and it's passing for me |
Co-Authored-By: lucksus <nicolas@lucksus.org>
…ility functions over to call_zome_function
…holochain-rust into refactor-nucleus-call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope this works to solve the flaky tests!
@lucksus I ran app-spec locally and it works just fine on my ubuntu system. Not sure why it's failing here. In any case this is much better than before... |
Co-Authored-By: lucksus <nicolas@lucksus.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not had a chance to read this thoroughly, but I see no red flags so I will approve now for timeliness. I'll read through now and can raise issues as followup if need be, but I'm not expecting that to be the case.
Purify call reducers
The main thing here is to replace
ExecuteZomeFunction
(the action and the reducer) by an action creator that returns a future. Just as we did everywhere else except here. This was overdue and happened now.Clean
hdk::call
The side effect is that we can use this action creator, the future return value and our home-grown
block_on
executor inhdk::call
, which hopefully gets rid of the flaky race condition. (and if not, we now have a much better overview of what is really happening)Steps roughly in commit order
nucleus/mod.rs
that contained all reducer functions into separate files undernucleus/reducer
call_zome_function
that spins of a WASM instance without any State change prior and that only dispatchesAction::ReturnZomeFunctionResult
after the factExecuteZomeFunction
(the action and the reducer)hdk::call
to also use above action creatorCall
(the action and the reducer)SignalZomeFunctionCall
After discussing this in our heartbeat with @maackle, I've readded an action that gets dispatched when a zome function gets called. Since there is no reducer for this action (i.e. no state change) I've named it
Signal..
. It is used by the nodejs test waiter as a signal to attach waiters..