Skip to content

Commit

Permalink
feat: filter out nil actions in action waiter (#464)
Browse files Browse the repository at this point in the history
Filter out nil actions, to help users of the function.
  • Loading branch information
jooola committed Jun 25, 2024
1 parent c1aa180 commit 8c8af90
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 8c8af90

Please sign in to comment.