@@ -296,7 +296,7 @@ func (r *RemoteRuntimeService) cleanupErrorTimeouts() {
296
296
r .errorMapLock .Lock ()
297
297
defer r .errorMapLock .Unlock ()
298
298
for ID , timeout := range r .errorPrinted {
299
- if time .Now (). Sub (timeout ) >= identicalErrorDelay {
299
+ if time .Since (timeout ) >= identicalErrorDelay {
300
300
delete (r .lastError , ID )
301
301
delete (r .errorPrinted , ID )
302
302
}
@@ -317,7 +317,7 @@ func (r *RemoteRuntimeService) ContainerStatus(containerID string) (*runtimeapi.
317
317
if err != nil {
318
318
// Don't spam the log with endless messages about the same failure.
319
319
lastMsg , ok := r .lastError [containerID ]
320
- if ! ok || err .Error () != lastMsg || time .Now (). Sub (r .errorPrinted [containerID ]) >= identicalErrorDelay {
320
+ if ! ok || err .Error () != lastMsg || time .Since (r .errorPrinted [containerID ]) >= identicalErrorDelay {
321
321
klog .Errorf ("ContainerStatus %q from runtime service failed: %v" , containerID , err )
322
322
r .errorPrinted [containerID ] = time .Now ()
323
323
r .lastError [containerID ] = err .Error ()
@@ -505,7 +505,7 @@ func (r *RemoteRuntimeService) ContainerStats(containerID string) (*runtimeapi.C
505
505
defer r .errorMapLock .Unlock ()
506
506
if err != nil {
507
507
lastMsg , ok := r .lastError [containerID ]
508
- if ! ok || err .Error () != lastMsg || time .Now (). Sub (r .errorPrinted [containerID ]) >= identicalErrorDelay {
508
+ if ! ok || err .Error () != lastMsg || time .Since (r .errorPrinted [containerID ]) >= identicalErrorDelay {
509
509
klog .Errorf ("ContainerStatus %q from runtime service failed: %v" , containerID , err )
510
510
r .errorPrinted [containerID ] = time .Now ()
511
511
r .lastError [containerID ] = err .Error ()
0 commit comments