-
Notifications
You must be signed in to change notification settings - Fork 74
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
refactor(daemon): Coordinate host provideX
implementations
#2139
Conversation
5f17afc
to
8441d8d
Compare
133ebdd
to
d91fa5b
Compare
8441d8d
to
f8dca9c
Compare
9a3ce97
to
6d026a6
Compare
838a78f
to
595e36b
Compare
provideX
implementations
and etymologically, “order with”. |
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’m not entirely sold on the deferred tasks pattern but I’m going to take ownership of coming up with something better. Good to go!
tasks.push, | ||
); | ||
const workerFormulaIdentifier = tryGetWorkerFormulaIdentifier(workerName); | ||
prepareWorkerIncarnation(workerName, workerFormulaIdentifier, tasks.push); |
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.
Apropos of naming, and entirely irrelevant to this PR…
Ain’t it weird that JavaScript inherits the deque methods from Perl:
front | back | |
---|---|---|
put | unshift | push |
get | shift | pop |
Whereas for a single ended queue, we still reach for French?
front | back | |
---|---|---|
put | enqueue | |
get | dequeue |
AsyncQueue
inherits get
and put
from priors.
I don’t think enqueue
is wrong for serial jobs, but I’m not sure it’s the right word either.
Since you’re here, let me waste your time with this idea that’s been riding rent free in my hindbrain for at least ten years.
front | back | |
---|---|---|
put | pish | posh |
get | pip | pop |
peek | tip | top |
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.
💀
await E(host).provideWorker('foo'); | ||
await t.throwsAsync(() => E(host).evaluate('foo', '20', [], [], 'bar'), { | ||
message: | ||
'Cannot deliver "evaluate" to target; typeof target is "undefined"', |
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.
This is almost certainly a symptom of there being no entry in the worker weak map, or the internal facet for this formula being undefined anyway. I regret the internal/external separation and look forward to eliminating it.
595e36b
to
328c305
Compare
coordinate, verb, "to combine in harmonious relation or action." Refactors the host's `provideX()` methods such that they all: 1. Attempt to get the existing formula id for the provided name, if any. 2. If there is no existing formula id, incarnate and return a new value. All type checks during step 1 have been removed. In other words, if you attempt to provide something under an existing name that resolves to a different value type, you're on your own. We may revisit this decision in the future.
328c305
to
7483103
Compare
Fixes the provision of new (i.e. `NEW`) unnamed workers after #2139 broke it. Adds a regression test for this case.
Fixes the provision of new (i.e. `NEW`) unnamed workers after #2139 broke it. Adds a regression test for this case.
Progresses: #2086
Synchronizes the host's
provideWorker()
. In addition, coordinates the implementations of the host'sprovideX
methods such that they all:All type checks during step 1 have been removed. In other words, if you attempt to provide something under an existing name that resolves to a different value type, you're on your own. We may revisit this decision in the future.