mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Use nolint directive instead of stopping ticker, per liggit's suggestion
This commit is contained in:
parent
69d029bddb
commit
e78b3e8dfe
@ -157,10 +157,12 @@ func (m *manager) Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
klog.InfoS("Starting to sync pod status with apiserver")
|
klog.InfoS("Starting to sync pod status with apiserver")
|
||||||
syncTicker := time.NewTicker(syncPeriod)
|
|
||||||
|
//nolint:staticcheck // SA1015 Ticker can leak since this is only called once and doesn't handle termination.
|
||||||
|
syncTicker := time.NewTicker(syncPeriod).C
|
||||||
|
|
||||||
// syncPod and syncBatch share the same go routine to avoid sync races.
|
// syncPod and syncBatch share the same go routine to avoid sync races.
|
||||||
go wait.Forever(func() {
|
go wait.Forever(func() {
|
||||||
defer syncTicker.Stop()
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case syncRequest := <-m.podStatusChannel:
|
case syncRequest := <-m.podStatusChannel:
|
||||||
@ -169,7 +171,7 @@ func (m *manager) Start() {
|
|||||||
"statusVersion", syncRequest.status.version,
|
"statusVersion", syncRequest.status.version,
|
||||||
"status", syncRequest.status.status)
|
"status", syncRequest.status.status)
|
||||||
m.syncPod(syncRequest.podUID, syncRequest.status)
|
m.syncPod(syncRequest.podUID, syncRequest.status)
|
||||||
case <-syncTicker.C:
|
case <-syncTicker:
|
||||||
klog.V(5).InfoS("Status Manager: syncing batch")
|
klog.V(5).InfoS("Status Manager: syncing batch")
|
||||||
// remove any entries in the status channel since the batch will handle them
|
// remove any entries in the status channel since the batch will handle them
|
||||||
for i := len(m.podStatusChannel); i > 0; i-- {
|
for i := len(m.podStatusChannel); i > 0; i-- {
|
||||||
|
Loading…
Reference in New Issue
Block a user