-
Notifications
You must be signed in to change notification settings - Fork 10
Add blockchain monitor publisher to reconcile chain tips #33
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
Conversation
@@ -478,6 +478,18 @@ class BlockchainObserver { | |||
return result | |||
} | |||
|
|||
public func isMonitoring() async -> Bool { | |||
return await self.monitoringTracker.startTracking() |
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.
that seems like a very dangerous method if it's called before the monitor is running, seeing how it will prevent it from ever being started.
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.
will this be better?
public func isMonitoring() async throws -> Bool {
try await preloadMonitor()
return await self.monitoringTracker.startTracking()
}
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.
nah, just add a method to the monitoring Tracker to indicate whether or not it's tracking
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.
it will be reliable at the moment simply because it's an actor
@@ -478,7 +478,8 @@ class BlockchainObserver { | |||
return result | |||
} | |||
|
|||
public func isMonitoring() async -> Bool { | |||
public func isMonitoring() async throws -> Bool { | |||
try await preloadMonitor() |
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.
sorry, that makes it worse. You don't want a check (basically a getter) to change state
484fbe8
to
e02f22f
Compare
e02f22f
to
ff6533a
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.
LGTM, thanks!
Enable using Combine to subscribe to chain updates on an interval instead of Task.sleep