@@ -167,7 +167,7 @@ func errResourceToResourceStatus(err error, resource *unstructured.Unstructured,
167
167
// If the error is from the context, we don't attach that to the ResourceStatus,
168
168
// but just return it directly so the caller can decide how to handle this
169
169
// situation.
170
- if errors .Is (err , context .Canceled ) || errors .Is (err , context .DeadlineExceeded ) {
170
+ if errors .Is (err , context .Canceled ) || errors .Is (err , context .DeadlineExceeded ) || errWouldExceedContextDeadline ( err ) {
171
171
return nil , err
172
172
}
173
173
identifier := object .UnstructuredToObjMetadata (resource )
@@ -193,7 +193,7 @@ func errIdentifierToResourceStatus(err error, identifier object.ObjMetadata) (*e
193
193
// If the error is from the context, we don't attach that to the ResourceStatus,
194
194
// but just return it directly so the caller can decide how to handle this
195
195
// situation.
196
- if errors .Is (err , context .Canceled ) || errors .Is (err , context .DeadlineExceeded ) {
196
+ if errors .Is (err , context .Canceled ) || errors .Is (err , context .DeadlineExceeded ) || errWouldExceedContextDeadline ( err ) {
197
197
return nil , err
198
198
}
199
199
if apierrors .IsNotFound (err ) {
@@ -209,3 +209,15 @@ func errIdentifierToResourceStatus(err error, identifier object.ObjMetadata) (*e
209
209
Error : err ,
210
210
}, nil
211
211
}
212
+
213
+ func errWouldExceedContextDeadline (err error ) bool {
214
+ for {
215
+ next := errors .Unwrap (err )
216
+ if next == nil {
217
+ break
218
+ }
219
+ err = next
220
+ }
221
+
222
+ return err != nil && err .Error () == "rate: Wait(n=1) would exceed context deadline"
223
+ }
0 commit comments