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

Bug 1958759: #417 insights report - add basic retry logic in case of 404 #418

Merged
merged 3 commits into from
May 10, 2021

Conversation

tremes
Copy link
Contributor

@tremes tremes commented May 3, 2021

This is adding retry logic for the insights report pulling - addressing #417 and also updating Policy API version to v1.

Categories

  • Bugfix
  • Enhancement
  • Backporting
  • Others (CI, Infrastructure, Documentation)

Sample archive

No new data

Documentation

No update

Unit Tests

No new test

Privacy

Yes. There are no sensitive data in the newly collected information.

Changelog

References

https://issues.redhat.com/browse/???
https://bugzilla.redhat.com/show_bug.cgi?id=???
https://access.redhat.com/solutions/???

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 3, 2021
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tremes

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 3, 2021
@@ -152,11 +165,14 @@ func (r *Gatherer) RetrieveReport() {
}

firstPullDone = true
if !delayTimer.Stop() {
<-delayTimer.C
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still not clear to me whether we need to call this @joselsegura. This part of code was almost never (with waiting for clusterversion exception) called before AFAIK.
My thinking is following. We already drained the channel in this moment and thus the delayTimer.Stop() returns false (see https://golang.org/pkg/time/#Timer.Stop), which leads to blocking call of <-delayTimer.C. Maybe it should be:

if delayTimer.Stop() {
	<-delayTimer.C
}

or maybe I am completely wrong....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I wrote it a long time ago and I'm not 100% sure, but according to the example in the link to Golang time library, the Stop call will return "false" «if the timer has already expired or been stopped. Stop does not close the channel, to prevent a read from the channel succeeding incorrectly.»

So I think this logic is correct: if Stop returns "true", you are done with it. If it returns "false", you need to read from the channel to ensure anybody else is consuming it (if I am understanding the library reference correctly!).

It is probably a very rare corner case, so probably your solution will work much better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for Reset describes it even better IMO https://golang.org/pkg/time/#Timer.Reset and I think we don't need to call/check Stop, because it will always return false in this situation, because the timer has already expired (as per doc).

@tremes tremes changed the title WIP #417 insights report - add basic retry logic in case of 404 #417 insights report - add basic retry logic in case of 404 May 4, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 4, 2021
@rluders
Copy link
Contributor

rluders commented May 7, 2021

It looks pretty straightforward, so just reading the code it looks good.
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 7, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rluders, tremes

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@tremes tremes changed the title #417 insights report - add basic retry logic in case of 404 Bug 1958759: #417 insights report - add basic retry logic in case of 404 May 10, 2021
@openshift-ci openshift-ci bot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels May 10, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 10, 2021

@tremes: This pull request references Bugzilla bug 1958759, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.8.0) matches configured target release for branch (4.8.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @psimovec

In response to this:

Bug 1958759: #417 insights report - add basic retry logic in case of 404

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/test-infra repository.

@openshift-ci openshift-ci bot requested a review from psimovec May 10, 2021 06:04
@openshift-merge-robot openshift-merge-robot merged commit 5aedd85 into openshift:master May 10, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 10, 2021

@tremes: All pull requests linked via external trackers have merged:

Bugzilla bug 1958759 has been moved to the MODIFIED state.

In response to this:

Bug 1958759: #417 insights report - add basic retry logic in case of 404

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/test-infra repository.

@tremes tremes deleted the report_retry branch May 6, 2022 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants