Skip to content

Commit

Permalink
fix: bugfix of channel handling
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Jan 7, 2025
1 parent 948f790 commit 8698faa
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pkg/driver/hook/prestop.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,20 @@ func (h *hook) waitForVolumeAttachmentsCleanup(ctx context.Context) error {
tick := time.NewTicker(time.Second)
defer tick.Stop()

select {
case <-informerCh:
case <-tick.C:
log.Info().
Msg("Waiting for VolumeAttachments to be deleted")
case <-ctx.Done():
log.Error().
Err(ctx.Err()).
Msg("Stopped waiting for VolumeAttachments, therefore some resources might still remain")
for {
select {
case <-informerCh:
return nil
case <-tick.C:
log.Info().
Msg("Waiting for VolumeAttachments to be deleted")
case <-ctx.Done():
log.Error().
Err(ctx.Err()).
Msg("Stopped waiting for VolumeAttachments, therefore some resources might still remain")
return nil
}
}
return nil
}

func (h *hook) volumeAttachmentEventHandler(ctx context.Context, obj interface{}) error {
Expand Down

0 comments on commit 8698faa

Please sign in to comment.