Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Check if a condition is met before the polling interval has elapsed. #676

Open
kishen-v opened this issue Sep 24, 2024 · 4 comments · May be fixed by #678
Open

Enhancement: Check if a condition is met before the polling interval has elapsed. #676

kishen-v opened this issue Sep 24, 2024 · 4 comments · May be fixed by #678
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@kishen-v
Copy link
Contributor

What happened:

An instant first tick is preferred over long running operations, which may have a particular condition satisfied already.

func PollUntil(pollInterval, timeOut <-chan time.Time, condition func() (bool, error)) error {
for {
select {
case <-timeOut:
return fmt.Errorf("timed out while waiting for job to complete")
case <-pollInterval:
if done, err := condition(); err != nil {
return err
} else if done {
return nil
}
}
}

What you expected to happen:
The condition to be checked once when the function is invoked, to cut down on waiting for a condition that may already be achieved.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:
https://stackoverflow.com/questions/32705582/how-to-get-time-tick-to-tick-immediately

Environment:

  • pvsadm version (use pvsadm --version):
  • Environment - On-Prem or IBM PowerVS:
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Others:
@kishen-v kishen-v added the kind/bug Categorizes issue or PR as related to a bug. label Sep 24, 2024
@kishen-v
Copy link
Contributor Author

/good-first-issue

@ppc64le-cloud-bot
Copy link
Contributor

@kishen-v:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ppc64le-cloud-bot ppc64le-cloud-bot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Sep 24, 2024
@aman4433
Copy link

/assign

aman4433 pushed a commit to aman4433/pvsadm that referenced this issue Sep 27, 2024
aman4433 pushed a commit to aman4433/pvsadm that referenced this issue Sep 27, 2024
aman4433 pushed a commit to aman4433/pvsadm that referenced this issue Sep 27, 2024
…ion.

Fixed ppc64le-cloud#676: Validate conditions immediately upon invocation.
aman4433 pushed a commit to aman4433/pvsadm that referenced this issue Sep 27, 2024
…ion.

Fixed ppc64le-cloud#676: Validate conditions immediately upon invocation.
aman4433 pushed a commit to aman4433/pvsadm that referenced this issue Sep 27, 2024
…ion.

Fixed ppc64le-cloud#676: Validate conditions immediately upon invocation.
aman4433 added a commit to aman4433/pvsadm that referenced this issue Sep 27, 2024
…ion.

Fixed ppc64le-cloud#676: Validate conditions immediately upon invocation.
@aman4433 aman4433 linked a pull request Sep 27, 2024 that will close this issue
@kishen-v
Copy link
Contributor Author

kishen-v commented Oct 3, 2024

/remove-kind bug
/kind feature

@ppc64le-cloud-bot ppc64le-cloud-bot added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants