-
Notifications
You must be signed in to change notification settings - Fork 74
Distributed singleton should be more careful with handover #1127
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
Distributed singleton should be more careful with handover #1127
Conversation
7af996b
to
c60fc7d
Compare
} | ||
} catch { | ||
throw error | ||
} |
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 do/catch is just here so we can add debug logging, will do shortly
capInterval: settings.locateActiveSingletonBackoff.capInterval, | ||
randomFactor: settings.locateActiveSingletonBackoff.randomFactor, | ||
maxAttempts: settings.locateActiveSingletonBackoff.maxAttempts | ||
).attempt { |
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.
Backoff.exponential().attemtpt {}
is very nice, we're finally beginning to reap benefits of async/await inside the cluster :)
Minor follow up ticket #1129 |
I'll merge so we have less flaky tests but please do review when you're back from break @yim-lee ! |
var backoff = self | ||
var lastError: Error? | ||
defer { | ||
pprint("RETURNING NOW singleton") |
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.
Not intended to keep here I think?
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.
Thanks!
case .none: | ||
self.updateSingleton(nil) | ||
} | ||
} | ||
|
||
// FIXME: would like to return `Act?` but can't via the generic combining with Codable: rdar://111664985 & https://github.com/apple/swift/issues/67090 |
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.
👍
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.
Solution incoming here: swiftlang/swift#67117
@@ -267,8 +310,8 @@ internal distributed actor ClusterSingletonBoss<Act: ClusterSingleton>: ClusterS | |||
try await singletonFactory(self.actorSystem) | |||
} | |||
|
|||
await singleton.whenLocal { __secretlyKnownToBeLocal in // TODO(distributed): this is annoying, we must track "known to be local" in |
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.
❤️
Don't review yet;
Resolves #1123 by hardedning how the redirecring is done. This is still not optimal but hit IRGen issue