From 5d0da5490ca60ba01e6a358877bca0c103f39423 Mon Sep 17 00:00:00 2001 From: Bot Date: Fri, 4 Sep 2026 18:46:58 +0800 Subject: [PATCH] fix(ci): allow server transfer task in telemetry-only mode and align authz reconnect test --- model/server.go | 12 ++++++------ service/rpc/apply_config_authz_test.go | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/model/server.go b/model/server.go index b8d07687..b3777afb 100644 --- a/model/server.go +++ b/model/server.go @@ -34,11 +34,11 @@ type Server struct { DDNSProfiles []uint64 `gorm:"-" json:"ddns_profiles,omitempty" validate:"optional"` // DDNS配置 OverrideDDNSDomains map[uint64][]string `gorm:"-" json:"override_ddns_domains,omitempty" validate:"optional"` - Host *Host `gorm:"-" json:"host,omitempty"` - State *HostState `gorm:"-" json:"state,omitempty"` - GeoIP *GeoIP `gorm:"-" json:"geoip,omitempty"` - LastActive time.Time `gorm:"-" json:"last_active,omitempty"` - TelemetryOnly bool `json:"telemetry_only" gorm:"default:false"` + Host *Host `gorm:"-" json:"host,omitempty"` + State *HostState `gorm:"-" json:"state,omitempty"` + GeoIP *GeoIP `gorm:"-" json:"geoip,omitempty"` + LastActive time.Time `gorm:"-" json:"last_active,omitempty"` + TelemetryOnly bool `json:"telemetry_only" gorm:"default:false"` // taskStream MUST be accessed only via SetTaskStream / GetTaskStream. Direct // field access from outside this file races with the gRPC RequestTask @@ -319,7 +319,7 @@ func (s *Server) IsTelemetryOnly() bool { } func (s *Server) SendTask(task *pb.Task) error { - if s.IsTelemetryOnly() && task != nil && !IsServiceMonitorType(task.GetType()) { + if s.IsTelemetryOnly() && task != nil && !IsServiceMonitorType(task.GetType()) && task.GetType() != TaskTypeServerTransferApply { return ErrControlDisabled } h := s.taskStream.Load() diff --git a/service/rpc/apply_config_authz_test.go b/service/rpc/apply_config_authz_test.go index 5f290a54..fb8c7fad 100644 --- a/service/rpc/apply_config_authz_test.go +++ b/service/rpc/apply_config_authz_test.go @@ -389,7 +389,9 @@ func runApplyConfigAuthzReconnect(t *testing.T, secret, uuid string) []*pb.Task "client_uuid", uuid, )), onSend: func(task *pb.Task) { - sent = append(sent, task) + if task.Type == model.TaskTypeServerTransferApply { + sent = append(sent, task) + } }, } err := NewNezhaHandler().RequestTask(stream)