Skip to content

Commit

Permalink
feat: filter out nil actions in action waiter (#464) (#471)
Browse files Browse the repository at this point in the history
Filter out nil actions, to help users of the function.

Backport commit 4fc9a40 into
release-1.x
  • Loading branch information
jooola authored Jun 25, 2024
1 parent 659a1fc commit 14bf589
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hcloud/action_waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var _ ActionWaiter = (*ActionClient)(nil)
//
// The handleUpdate callback is called every time an action is updated.
func (c *ActionClient) WaitForFunc(ctx context.Context, handleUpdate func(update *Action) error, actions ...*Action) error {
// Filter out nil actions
actions = slices.DeleteFunc(actions, func(a *Action) bool { return a == nil })

running := make(map[int]struct{}, len(actions))
for _, action := range actions {
if action.Status == ActionStatusRunning {
Expand Down

0 comments on commit 14bf589

Please sign in to comment.