Skip to content

Comments

Safer lifecycle watch api#961

Merged
ktoso merged 6 commits intoapple:mainfrom
ktoso:wip-safer-lifecycle-watch
Jun 14, 2022
Merged

Safer lifecycle watch api#961
ktoso merged 6 commits intoapple:mainfrom
ktoso:wip-safer-lifecycle-watch

Conversation

@ktoso
Copy link
Member

@ktoso ktoso commented Jun 8, 2022

A safer shape of the lifecycle API

Resolves #884

@ktoso ktoso force-pushed the wip-safer-lifecycle-watch branch from 9f4885c to 913d060 Compare June 10, 2022 00:39
@ktoso ktoso changed the title [WIP] Safer lifecycle watch api Safer lifecycle watch api Jun 10, 2022
@ktoso
Copy link
Member Author

ktoso commented Jun 10, 2022

No joy, we have a crash on the nightly but not in betas on macOS -- investigating.

@ktoso ktoso force-pushed the wip-safer-lifecycle-watch branch from 1922d83 to 0b024da Compare June 14, 2022 09:49
@ktoso ktoso force-pushed the wip-safer-lifecycle-watch branch from 0b024da to 5955887 Compare June 14, 2022 09:53
extension LifecycleWatchContainer {
/// Performed by the sending side of "watch", therefore the `watcher` should equal `context.myself`
public func termination<Watchee>(
of watchee: Watchee,
Copy link
Member Author

Choose a reason for hiding this comment

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

Current dev branches REALLY don't like the generic here (regardless of the self capture things below)

.tvOS(.v16),
.watchOS(.v9),
]
#endif
Copy link
Member Author

Choose a reason for hiding this comment

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

Workaround for 5.7 docker images being pre-wwdc.

@ktoso
Copy link
Member Author

ktoso commented Jun 14, 2022

Going to merge this to make progress with the other "parked" PRs, but review is welcome @yim-lee !
I'll be cleaning up more and adding more docs in a follow up

@ktoso ktoso merged commit 04a1f1f into apple:main Jun 14, 2022
@ktoso ktoso deleted the wip-safer-lifecycle-watch branch June 14, 2022 11:39
}

private func onWorkerTerminated(id: Worker.ID) {
public distributed func terminated(actor id: Worker.ID) {
Copy link
Member

@yim-lee yim-lee Jun 14, 2022

Choose a reason for hiding this comment

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

This new API works out rather nicely I think (e.g., even less code duplication).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's pretty nice actually:)

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.

Audit LifecycleWatch API shape

2 participants