Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Refactor Nucleus and Zome Calls to pure reducers #991

Merged
merged 33 commits into from
Feb 13, 2019
Merged

Conversation

lucksus
Copy link
Collaborator

@lucksus lucksus commented Feb 12, 2019

  • I have added a summary of my changes to the changelog

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 in hdk::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

  • Break down nucleus/mod.rs that contained all reducer functions into separate files under nucleus/reducer
  • Add action creator call_zome_function that spins of a WASM instance without any State change prior and that only dispatches Action::ReturnZomeFunctionResult after the fact
  • Remove ExecuteZomeFunction (the action and the reducer)
  • Refactor hdk::call to also use above action creator
  • Remove Call (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..

@lucksus lucksus added review WIP work in progress labels Feb 12, 2019
@lucksus lucksus changed the title [WIP] Refactor Nucleus and call [WIP] Refactor Nucleus and Zome Calls to pure reducers Feb 12, 2019
@zippy
Copy link
Member

zippy commented Feb 12, 2019

Looking good! I just renabled the call_test_assigned test and it's passing for me

core/src/nucleus/actions/call_zome_function.rs Outdated Show resolved Hide resolved
@lucksus lucksus changed the title [WIP] Refactor Nucleus and Zome Calls to pure reducers Refactor Nucleus and Zome Calls to pure reducers Feb 12, 2019
@lucksus lucksus removed the WIP work in progress label Feb 12, 2019
Copy link
Member

@zippy zippy left a 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!

@zippy
Copy link
Member

zippy commented Feb 13, 2019

@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...

Copy link
Member

@maackle maackle left a 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.

@zippy zippy merged commit de54e5f into develop Feb 13, 2019
@zippy zippy removed the review label Feb 13, 2019
@zippy zippy deleted the refactor-nucleus-call branch July 4, 2019 19:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants