Skip to content
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): Synchronize makeGuest #2120

Merged
merged 7 commits into from
Mar 8, 2024

Conversation

rekmarks
Copy link
Contributor

@rekmarks rekmarks commented Mar 8, 2024

Progresses: #2086

Synchronizes the host's makeGuest() and its dependencies. See #2086 for details.

Comment on lines +88 to +95
// TODO: Return early if the formula identifier is the same.
if (petNames.has(petName)) {
// Perform cleanup on the overwritten pet name.
const formulaPetNames = formulaIdentifiers.get(petName);
if (formulaPetNames !== undefined) {
formulaPetNames.delete(petName);
}
// TODO: Should this only happen if something is actually deleted?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed these couple oddities in the pet store's write(). I'll create an issue if we agree that there's something to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kriskowal thoughts on these?

Copy link
Member

@kriskowal kriskowal Mar 11, 2024

Choose a reason for hiding this comment

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

It would somewhat simplify client code if they are assured that they only see delete messages for equal but opposite prior add.

@rekmarks rekmarks force-pushed the rekmarks-synchronize-makeGuest branch from acaf382 to 45e718a Compare March 8, 2024 01:29
@rekmarks rekmarks force-pushed the rekmarks-synchronize-makeGuest branch from 45e718a to 14ae908 Compare March 8, 2024 01:40
/**
* @returns {import('./types.js').AsyncHooks<any>}
*/
export const makeAsyncHooks = () => {
Copy link
Member

Choose a reason for hiding this comment

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

There’s a Node.js module by the same name that we don’t want to confuse this with. This is similar to a WaitGroup in Go. I think DeferredSet might be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with deferredTasks.

packages/daemon/src/daemon.js Outdated Show resolved Hide resolved
packages/daemon/src/daemon.js Show resolved Hide resolved
packages/daemon/src/daemon.js Outdated Show resolved Hide resolved
packages/daemon/src/host.js Show resolved Hide resolved
return {
value: Promise.resolve(value),
Copy link
Member

Choose a reason for hiding this comment

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

Is the type system demanding we wrap these? Maybe we should use Awaited<T> somewhere.

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The type system does demand this. Since this was already here, I'll leave it for now. Should we create an issue?

Copy link
Member

Choose a reason for hiding this comment

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

Meh. Not big enough to track.

@rekmarks rekmarks force-pushed the rekmarks-synchronize-makeGuest branch from 14ae908 to f546680 Compare March 8, 2024 06:50
@rekmarks rekmarks enabled auto-merge March 8, 2024 06:53
@rekmarks rekmarks merged commit d007e19 into master Mar 8, 2024
14 checks passed
@rekmarks rekmarks deleted the rekmarks-synchronize-makeGuest branch March 8, 2024 06:56
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.

3 participants