Add hook to init and listen observatory statuses

This commit is contained in:
世界
2021-09-05 10:47:09 +08:00
parent 390a76ff61
commit 5bf2b31883
2 changed files with 18 additions and 0 deletions
+6
View File
@@ -32,6 +32,8 @@ type Observer struct {
finished *done.Instance
ohm outbound.Manager
StatusUpdate func(result *OutboundStatus)
}
func (o *Observer) GetObservation(ctx context.Context) (proto.Message, error) {
@@ -183,6 +185,10 @@ func (o *Observer) updateStatusForResult(outbound string, result *ProbeResult) {
status.LastErrorReason = result.LastErrorReason
status.Delay = 99999999
}
if o.StatusUpdate != nil {
o.StatusUpdate(status)
}
}
func (o *Observer) findStatusLocationLockHolderOnly(outbound string) int {