@@ -158,9 +158,9 @@ func NewObjectStorageControllerWithClientset(identity string, leaderLockName str
158
158
159
159
ResyncPeriod : 30 * time .Second ,
160
160
// leader election
161
- LeaseDuration : 60 * time .Second ,
162
- RenewDeadline : 30 * time .Second ,
163
- RetryPeriod : 15 * time .Second ,
161
+ LeaseDuration : 150 * time .Second ,
162
+ RenewDeadline : 120 * time .Second ,
163
+ RetryPeriod : 60 * time .Second ,
164
164
165
165
opMap : & sync.Map {},
166
166
}, nil
@@ -258,7 +258,7 @@ func (c *ObjectStorageController) processNextItem(ctx context.Context) bool {
258
258
259
259
op , ok := c .opMap .Load (uuid )
260
260
if ! ok {
261
- panic ( "unreachable code" )
261
+ return true
262
262
}
263
263
264
264
// Ensure that multiple operations on different versions of the same object
@@ -270,22 +270,16 @@ func (c *ObjectStorageController) processNextItem(ctx context.Context) bool {
270
270
case addOp :
271
271
add := * o .AddFunc
272
272
err = add (ctx , o .Object )
273
- if err == nil {
274
- o .Indexer .Add (o .Object )
275
- }
273
+ o .Indexer .Add (o .Object )
276
274
case updateOp :
277
275
update := * o .UpdateFunc
278
276
err = update (ctx , o .OldObject , o .NewObject )
279
- if err == nil {
280
- o .Indexer .Update (o .NewObject )
281
- }
277
+ o .Indexer .Update (o .NewObject )
282
278
case deleteOp :
283
279
delete := * o .DeleteFunc
284
280
err = delete (ctx , o .Object )
285
- if err == nil {
286
- o .Indexer .Delete (o .Object )
287
- c .opMap .Delete (uuid )
288
- }
281
+ o .Indexer .Delete (o .Object )
282
+ c .opMap .Delete (uuid )
289
283
default :
290
284
panic ("unknown item in queue" )
291
285
}
@@ -321,6 +315,7 @@ func (c *ObjectStorageController) GetOpLock(op types.UID) *sync.Mutex {
321
315
// handleErr checks if an error happened and makes sure we will retry later.
322
316
func (c * ObjectStorageController ) handleErr (err error , uuid types.UID ) {
323
317
if err == nil {
318
+ c .opMap .Delete (uuid )
324
319
return
325
320
}
326
321
c .queue .AddRateLimited (uuid )
0 commit comments