Skip to content

Commit 56f422e

Browse files
committed
fix[bitdefender-plugin]: make StartServer blocking and remove retry loop
1 parent 3a82d52 commit 56f422e

3 files changed

Lines changed: 5 additions & 27 deletions

File tree

plugins/bitdefender/go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ require (
66
github.com/google/uuid v1.6.0
77
github.com/gorilla/mux v1.8.1
88
github.com/threatwinds/go-sdk v1.0.43
9-
github.com/utmstack/config-client-go v1.2.7
109
google.golang.org/grpc v1.74.2
10+
google.golang.org/protobuf v1.36.6
1111
)
1212

1313
require (
@@ -47,7 +47,6 @@ require (
4747
golang.org/x/text v0.27.0 // indirect
4848
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074 // indirect
4949
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 // indirect
50-
google.golang.org/protobuf v1.36.6 // indirect
5150
gopkg.in/yaml.v3 v3.0.1 // indirect
5251
sigs.k8s.io/yaml v1.5.0 // indirect
5352
)

plugins/bitdefender/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
9595
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
9696
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
9797
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
98-
github.com/utmstack/config-client-go v1.2.7 h1:JeRdI5JjH1liNzMW3LmyevjuPd67J/yt9MAO3+oJAuM=
99-
github.com/utmstack/config-client-go v1.2.7/go.mod h1:kM0KoUizM9ZlcQp0qKviGTWn/+anT5Rfjx3zfZk79nM=
10098
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
10199
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
102100
go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg=

plugins/bitdefender/server/server.go

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,8 @@ func StartServer() {
112112
TLSConfig: tlsConfig,
113113
}
114114

115-
go func() {
116-
maxRetries := 3
117-
retryDelay := 2 * time.Second
118-
119-
for retry := 0; retry < maxRetries; retry++ {
120-
err := server.ListenAndServeTLS("", "")
121-
if err == nil {
122-
return
123-
}
124-
125-
_ = catcher.Error("error creating server, retrying", err, map[string]any{
126-
"retry": retry + 1,
127-
"maxRetries": maxRetries,
128-
})
129-
130-
if retry < maxRetries-1 {
131-
time.Sleep(retryDelay)
132-
retryDelay *= 2
133-
} else {
134-
_ = catcher.Error("all retries failed when creating server", err, nil)
135-
}
136-
}
137-
}()
115+
err = server.ListenAndServeTLS("", "")
116+
if err != nil {
117+
_ = catcher.Error("server stopped unexpectedly", err, nil)
118+
}
138119
}

0 commit comments

Comments
 (0)