Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve reliability of chain element 'etcd' #523

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading