Skip to content

Commit

Permalink
Merge pull request #523 from networkservicemesh/reliable-watch
Browse files Browse the repository at this point in the history
Improve reliability of chain element 'etcd'
  • Loading branch information
edwarnicke committed Sep 24, 2024
2 parents 9c87849 + 4bd317f commit e3a1092
Show file tree
Hide file tree
Showing 7 changed files with 431 additions and 257 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,7 @@ issues:
- goheader
- dupl
- revive
# It's ok to have dupl code in tests files
- path: ".*.test.go"
linters:
- dupl
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/networkservicemesh/sdk-k8s
go 1.20

require (
github.com/edwarnicke/serialize v1.0.7
github.com/fsnotify/fsnotify v1.5.4
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.1
Expand Down Expand Up @@ -33,7 +34,6 @@ require (
github.com/edwarnicke/exechelper v1.0.2 // indirect
github.com/edwarnicke/genericsync v0.0.0-20220910010113-61a344f9bc29 // indirect
github.com/edwarnicke/grpcfd v1.1.4 // indirect
github.com/edwarnicke/serialize v1.0.7 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand Down
14 changes: 12 additions & 2 deletions pkg/registry/etcd/context.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cisco and/or its affiliates.
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -16,7 +16,10 @@

package etcd

import "context"
import (
"context"
"time"
)

type versionKey struct{}

Expand All @@ -28,3 +31,10 @@ func nseVersionFromContext(ctx context.Context) (string, bool) {
version, ok := ctx.Value(versionKey{}).(string)
return version, ok
}

func min(a, b time.Duration) time.Duration {
if a > b {
return b
}
return a
}
Loading

0 comments on commit e3a1092

Please sign in to comment.