Skip to content

Conversation

@steve-the-edwards
Copy link
Contributor

@steve-the-edwards steve-the-edwards commented Aug 3, 2023

Add in some yield() in the runtime so that we can start any running side effect after each render() before processing the next action, which might tear down that side effect's Job.

Side Effect Job's are launched lazily in case they send to teh actionSink (so we can complete the render before they get dispatched).

Also brings in headlessIntegrationTest which was being used internally for some time.

Brings this in in order to right some tests for whether or not these side effects are run under certain circumstances.

Closes #1093

@steve-the-edwards steve-the-edwards force-pushed the sedwards/lifecycle-worker-yield branch 4 times, most recently from 3202cb7 to f896709 Compare August 3, 2023 21:36
// And emit the Output.
sendOutput(actionResult, onOutput)
// Yield if there are any side effects (they were launched lazily) that need starting.
yield()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we shouldn't yield() first, before we allow the UI to update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to get the side effects started before then you mean? Or because we don't want the collectors of the StateFlow of renderings to be in contention for dispatch at the same time?

Copy link
Collaborator

@rjrjr rjrjr Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The former was what I was thinking of -- seems like a side effect should happen, or start happening, before / while the UI is updating. Am I over or under thinking it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought exercise: what happens if something on the receiving end of sendOutput kills off the workflow runtime before that yield() happens (if it that's possible). Would we be surprised that the last declared side effects were never run? I think we would.

Copy link
Contributor Author

@steve-the-edwards steve-the-edwards Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all legitimate points. I adjusted the ordering to yield() immediately after rendering in the updated PR.

@steve-the-edwards steve-the-edwards force-pushed the sedwards/lifecycle-worker-yield branch from f896709 to 44d9e39 Compare August 4, 2023 16:12
Add headlessIntegrationTest to renderWorkflowIn with a nice Turbine attached.

Increase perf benchmarks render pass expectations as yield() will do that.

Closes #1093
@steve-the-edwards steve-the-edwards force-pushed the sedwards/lifecycle-worker-yield branch from 44d9e39 to 4396fb2 Compare August 4, 2023 19:55
@steve-the-edwards
Copy link
Contributor Author

This isn't desirable as it creates unnecessary thrash after the render() pass.

@steve-the-edwards
Copy link
Contributor Author

Closing and this is not needed. It doesn't work and we went with #1106 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Side effects / Workers / LifecycleWorker methods not called if rendered/not rendered without ever yielding dispatch

3 participants