@@ -17,12 +17,6 @@ import (
1717)
1818
1919const (
20- // Prefix for GRPC URL inputs. GRPC does not define a standard prefix. This prefix helps to differentiate remote
21- // URLs for REST APIs (i.e - HTTP) from GRPC endpoints.
22- Prefix = "grpc://"
23- PrefixSecure = "grpcs://"
24- SupportedScheme = "(envoy|dns|uds|xds)"
25-
2620 // Default timeouts and retry intervals
2721 defaultKeepaliveTime = 30 * time .Second
2822 defaultKeepaliveTimeout = 5 * time .Second
@@ -72,8 +66,6 @@ type FlagSyncServiceClientResponse interface {
7266 syncv1grpc.FlagSyncService_SyncFlagsClient
7367}
7468
75- var once msync.Once
76-
7769// Sync implements gRPC-based flag synchronization with improved context cancellation and error handling
7870type Sync struct {
7971 // Configuration
@@ -94,6 +86,7 @@ type Sync struct {
9486 events chan SyncEvent
9587 shutdownComplete chan struct {}
9688 shutdownOnce msync.Once
89+ initializer msync.Once
9790}
9891
9992// Init initializes the gRPC connection and starts background monitoring
@@ -256,7 +249,7 @@ func (g *Sync) performSyncCycle(ctx context.Context, dataSync chan<- sync.DataSy
256249// handleFlagSync processes messages from the sync stream with proper context handling
257250func (g * Sync ) handleFlagSync (ctx context.Context , stream syncv1grpc.FlagSyncService_SyncFlagsClient , dataSync chan <- sync.DataSync ) error {
258251 // Mark as ready on first successful stream
259- once .Do (func () {
252+ g . initializer .Do (func () {
260253 g .ready = true
261254 g .Logger .Info ("sync service is now ready" )
262255 })
0 commit comments