-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require Signals to get wrapped in a Worker #1025
Conversation
Signal
s to get wrapped in a Worker
590e677
to
90178f3
Compare
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.
CI checks are failing
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.
Did you consider making SignalWorker
abstract and having its own run()
method that returns a Signal
, mirroring Worker
? Seems odd that the api for creating Signal
workers vs SignalProducer
workers is different, although I'm sure there's a good reason (I'm just curious what it is).
I'm not entirely sure I follow what you're suggesting. |
This causes test failures due to unexpected Workers getting encountered. Instead, subscribe to the signal like we used to in `subscribe()`.
90178f3
to
220e9d8
Compare
@@ -270,16 +270,14 @@ fileprivate final class RenderTestContext<T: Workflow>: RenderContextType { | |||
let sink = Sink<Action> { action in | |||
observer.send(value: AnyWorkflowAction(action)) | |||
} | |||
subscribe(signal: signal) |
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.
Because subscribe
has been removed I moved its logic up into this function and am subscribing directly — i.e. I'm not wrapping the Signal
here in a worker (it creates test failures due to unexpected workers being encountered).
I don't see what the temperature of the stream has to do with it. Making it an extendable type means implementors can implement |
} | ||
|
||
public func isEquivalent(to otherWorker: SignalWorker) -> Bool { | ||
return key == otherWorker.key |
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.
@bencochran Is Key
comparison enough here? Do we run into the "need consumers to understand that Key
needs to be differentiated enough" problem?
We're going to split this PR into two:
That way, we can land the first, integrate it (incrementally), and fix any issues that come out of that. |
Sounds great, incremental is better and less painful! |
This should address #402. The aesthetics of the
SignalWorker
are very much open for feedback. We could also leavecontext.subscribe
in place and create the worker in the infrastructure layer instead.