From ab803000e78bc3454c9b3cb61e046c55ca66d0e2 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Sat, 19 Jun 2021 12:19:21 +0100 Subject: [PATCH] bug fix for observer --- app/observatory/burst/burstobserver.go | 4 ++-- infra/conf/observatory.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/observatory/burst/burstobserver.go b/app/observatory/burst/burstobserver.go index f9364eb45..a1bf45455 100644 --- a/app/observatory/burst/burstobserver.go +++ b/app/observatory/burst/burstobserver.go @@ -2,13 +2,13 @@ package burst import ( "context" + "github.com/golang/protobuf/proto" core "github.com/v2fly/v2ray-core/v4" "github.com/v2fly/v2ray-core/v4/app/observatory" "github.com/v2fly/v2ray-core/v4/common" "github.com/v2fly/v2ray-core/v4/common/signal/done" "github.com/v2fly/v2ray-core/v4/features/extension" "github.com/v2fly/v2ray-core/v4/features/outbound" - "google.golang.org/protobuf/proto" "sync" ) @@ -34,7 +34,7 @@ func (o *Observer) createResult() []*observatory.OutboundStatus { defer o.hp.access.Unlock() for name, value := range o.hp.Results { status := observatory.OutboundStatus{ - Alive: value.getStatistics().All == value.getStatistics().Fail, + Alive: value.getStatistics().All != value.getStatistics().Fail, Delay: value.getStatistics().Average.Milliseconds(), LastErrorReason: "", OutboundTag: name, diff --git a/infra/conf/observatory.go b/infra/conf/observatory.go index bb586ac41..5eadd491c 100644 --- a/infra/conf/observatory.go +++ b/infra/conf/observatory.go @@ -28,7 +28,7 @@ type BurstObservatoryConfig struct { } func (b BurstObservatoryConfig) Build() (proto.Message, error) { - if result, err := b.HealthCheck.Build(); err != nil { + if result, err := b.HealthCheck.Build(); err == nil { return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil } else { return nil, err