Commit Graph

22 Commits

Author SHA1 Message Date
Patrick Ohly
a96aa53864 client-go workqueue: add optional logger
NewTypedDelayingQueueWithConfig spawns a goroutine, but apparently shutdown is
already handled somehow. Therefore only the option to set a logger gets added
to the Config struct.

The problem then becomes that developers might forget to set that
logger. logcheck can't detect that. For now, all in-tree users get updated
immediately.

Kubernetes-commit: f20eb2e7c16a9b28e69fd0bba2000e7166d68f29
2024-12-11 12:45:57 +01:00
Antonin Bas
3c28f81659 Use generics for waitFor (delaying workqueue) in client-go
With this change, we can typically avoid an extra heap allocation when
calling AddAfter with a positive duration (which causes the creation of
a waitFor object). This is because workqueues are typically used with
string keys, and casting a string (or more generally, non-pointer types)
to an `interface{}` will cause an heap escape / allocation.

Ater this change, there is no longer any usage of `type t interface{}`,
which was creating some confusion after the switch to generics in the
workqueue package.

Co-authored-by: Quan Tian <quan.tian@broadcom.com>
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>

Kubernetes-commit: 53ddffb55709857fec6bddbd5ca4ca1b03f7da97
2024-10-08 15:12:11 -07:00
Alvaro Aleman
71640ef872 Fix accidental breaking change in TypedNewDelayingQueue
It was added for compatibility reason but ended up getting a `config`
argument by accident, resulting in not actually being compatible, this
change fixes that.

Kubernetes-commit: 6933c1bc229c196e9c71061e19a0cdc76adb1dbc
2024-09-30 18:33:30 -04:00
Alvaro Aleman
c311da2251 Rename TypedNewDelayingQueue to NewTypedDelayingQueue
This change renames NewTypedDelayingQueue to NewTypedDelayingQueue to
stay consistent with the naming scheme in the package. A
NewTypedDelayingQueue constructor is kept for backwards compatibility
but marked as deprecated.

Kubernetes-commit: 45da5dc30ecf0ba4c4b44befd96b8617278c496b
2024-08-31 12:11:20 -04:00
Alvaro Aleman
d67dddfe90 Workqueue: Add generic versions that are properly typed
This change adds a generic version of the various workqueue types while
retaining compatibility for the existing exported symbols and constructors.
The generic variants are prefixed with `Typed` and the existing ones are
marked as deprecated to nudge people to transition without breaking
them.

Kubernetes-commit: 0c7370bb851c15825d30a516722139ccccca0cfc
2024-04-11 18:11:41 -04:00
austin ce
21b4553e44 Allow custom metric provider for retry metrics
Kubernetes-commit: a60624ffbc265d61b35cab16ea9ded485909f3ed
2023-03-10 17:48:10 -05:00
austin ce
66fa9d308f Unify queue constructors, deprecate current constructors
Kubernetes-commit: fea83b78243c77e81b91f3f0a812979809aeacaf
2023-03-10 17:46:26 -05:00
austin ce
e0785d6713 Remove options from queue ctors w/o metrics
Kubernetes-commit: 31f16db1959bb1db02fcc578f4aa7d47414a26f4
2022-12-02 14:06:37 -05:00
austin ce
98d0d1a9ba Allow setting per-queue metrics providers
Kubernetes-commit: da71811514ac6e8fedd265831fed71f897b97781
2022-11-29 20:47:33 -05:00
Spencer Peterson
5a537879c2 Document when workqueue metrics are dropped
Two simple choices for workqueues do not document that they do not emit
metrics. Using their named variants fixes this, but was undocumented.

Change-Id: I100ad08a4859513987941ed35d12abb4cbb39873

Kubernetes-commit: f468bee672b0ccf9b97a85f17ec1f5645aced926
2021-12-09 16:59:54 -08:00
wojtekt
14a51589c3 Migratet to k8s.io/utils/clock in workqueue
Kubernetes-commit: 392292ba81964e6ee7badec360a800b1f8645f2f
2021-09-09 16:38:59 +02:00
fatedier
1ded602dc0 Export new constructor for DelayingQueue
Kubernetes-commit: b5d989a6fc78fd8d1743eb2b80b9be4cb6e3c6ac
2020-03-23 12:15:29 +08:00
Jacek Kaniuk
d81654af9d pkg/util/workqueue/delaying_queue: export contructor with custom clock
Kubernetes-commit: 638c02f6cdb4e269f46b60fe1f91e553cfc59749
2019-10-23 16:07:38 +02:00
Michael Morello
8a1fbdc8bb Fix memory and timer leak in work queue
Kubernetes-commit: f9c3d246d32cd440a8ea5ea40f02b6a9bfe4b485
2019-10-15 10:06:06 +02:00
Sergiusz Urbaniak
ee078c72e2 pkg/util/workqueue: delete deprecated metrics
This deletes deprecated metrics and simplifies registration.

Kubernetes-commit: 4532cfd85c00da6f64e03fcf05f5636adc1151c7
2019-05-13 13:22:08 +02:00
Clayton Coleman
bdead75b4b DelayingQueue.ShutDown() should be reentrant
All queue ShutDown() calls should be able to be invoked multiple times.

```
Observed a panic: "close of closed channel" (close of closed channel)
/go/src/github.com/openshift/cluster-version-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:76
/go/src/github.com/openshift/cluster-version-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:65
/go/src/github.com/openshift/cluster-version-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:51
/usr/local/go/src/runtime/asm_amd64.s:573
/usr/local/go/src/runtime/panic.go:502
/usr/local/go/src/runtime/chan.go:333
/go/src/github.com/openshift/cluster-version-operator/vendor/k8s.io/client-go/util/workqueue/delaying_queue.go:137
```

Use sync.Once to guarantee a single close.

Kubernetes-commit: d2f7eb5235a93556261c8947e7a87342aeeaee2b
2019-04-27 16:16:55 -04:00
danielqsj
c270b352df Use prometheus conventions for workqueue metrics
Kubernetes-commit: b828bc1a50dfa29ab85248e5af6da5acb27189c1
2018-11-21 11:43:47 +08:00
Mikhail Mazurskiy
9446f4ef9d Stop() for Ticker to enable leak-free code
Kubernetes-commit: 1f393cdef96fe6e4ddcbf93825d65a9980463406
2018-03-31 19:41:43 +11:00
Di Xu
d39d12f4b0 fix all the typos across the project
Kubernetes-commit: 48388fec7eaad4ac8d84fbe20673ffacf41964a1
2018-02-09 14:53:53 +08:00
Clayton Coleman
09165439d7 Refactor move of client-go/util/clock to apimachinery
Kubernetes-commit: 3e095d12b4f152a45b593927804e2e7b8816239a
2017-05-21 17:20:29 +00:00
Andy Lindeman
f851632ada Uses container/heap
Kubernetes-commit: dad64459a9b8c56d5bca681e37c3d0f44921d472
2017-05-15 17:20:25 +00:00
Kubernetes Publisher
b766ef93a4 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is a2b65f03bf83013d1af05c99b7aa22049ca63de3
2017-01-31 15:19:42 +00:00