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

retry after exception when getting GitHub token #132

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

Hafsa-Naeem
Copy link
Collaborator

@Hafsa-Naeem Hafsa-Naeem commented Dec 27, 2022

addresses one case of #20

Copy link
Contributor

@trz42 trz42 left a comment

Choose a reason for hiding this comment

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

Looks good. Some minor modifications suggested.

_token = github_integration.get_access_token(installation_id)
except NotImplementedError as err:
if i < tries - 1:
time.sleep(0.8)
Copy link
Contributor

Choose a reason for hiding this comment

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

This always waits 0.8 seconds. Maybe the waiting time could be $n * (i+1)$ seconds? $n$ being the default/minimum waiting time (thus waiting time would increase linearly: $n, 2n, 3n, \dots$). Alternatively, the waiting time could be $n^{(i+1)}$ seconds (thus waiting time would increase exponentially: $n, n^2, n^3, \dots$).

Copy link
Contributor

Choose a reason for hiding this comment

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

To be on the safe side, maybe wait for $1 + i * n$ seconds.

else:
logging.error(err)
_token = None
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the break needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it's needed. Probably easier to read if the break is moved to after line 41.

@boegel boegel marked this pull request as ready for review January 2, 2023 10:13
@trz42 trz42 merged commit b102d06 into EESSI:main Jan 9, 2023
@boegel boegel changed the title retry after exception retry after exception when getting GitHub token Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants