Skip to content

Commit 5ab671d

Browse files
authored
[Bugfix] Fix agency timeout (#1343)
1 parent b6efac0 commit 5ab671d

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

pkg/apis/deployment/v1/sync_external_access_spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.

pkg/debug_package/cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.

pkg/deployment/agency/loader.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
agencyCache "github.com/arangodb/kube-arangodb/pkg/deployment/agency/cache"
29+
"github.com/arangodb/kube-arangodb/pkg/util/globals"
2930
)
3031

3132
func getLoader[T interface{}]() agencyCache.StateLoader[T] {
@@ -102,19 +103,29 @@ func (s *simpleStateLoader[T]) Refresh(ctx context.Context, discovery agencyCach
102103
s.lock.Lock()
103104
defer s.lock.Unlock()
104105

105-
conn, err := discovery.Discover(ctx)
106+
lctx, cancel := globals.GetGlobalTimeouts().Agency().WithTimeout(ctx)
107+
defer cancel()
108+
109+
conn, err := discovery.Discover(lctx)
106110
if err != nil {
107111
return err
108112
}
109113

110-
cfg, err := GetAgencyConfig(ctx, conn)
114+
cctx, cancel := globals.GetGlobalTimeouts().Agency().WithTimeout(ctx)
115+
defer cancel()
116+
117+
cfg, err := GetAgencyConfig(cctx, conn)
111118
if err != nil {
112119
return err
113120
}
114121

115122
if !s.valid || s.index != cfg.CommitIndex {
116123
// Full reload
117-
state, err := GetAgencyState[T](ctx, conn)
124+
125+
sctx, cancel := globals.GetGlobalTimeouts().Agency().WithTimeout(ctx)
126+
defer cancel()
127+
128+
state, err := GetAgencyState[T](sctx, conn)
118129
if err != nil {
119130
return err
120131
}

pkg/deployment/deployment.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ func (d *Deployment) RefreshAgencyCache(ctx context.Context) (uint64, error) {
180180

181181
if info := d.currentObject.Status.Agency; info != nil {
182182
if size := info.Size; size != nil {
183-
lCtx, c := globals.GetGlobalTimeouts().Agency().WithTimeout(ctx)
184-
defer c()
185-
186183
rsize := int(*size)
187184

188185
clients := agency.Connections{}
@@ -195,7 +192,7 @@ func (d *Deployment) RefreshAgencyCache(ctx context.Context) (uint64, error) {
195192
clients[m.ID] = a
196193
}
197194

198-
return d.agencyCache.Reload(lCtx, rsize, clients)
195+
return d.agencyCache.Reload(ctx, rsize, clients)
199196
}
200197
}
201198

pkg/deployment/resources/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)