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

Make sure we refresh the PRs with the PR API (and not the issues API) #1810

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

gsmet
Copy link
Contributor

@gsmet gsmet commented Mar 9, 2024

When a PR was loaded from a search, the refresh() method was reloading information from the issues API, which would lead to some information not being refreshed properly, typically the mergeable state.

Related to #1779 (comment)

When a PR was loaded from a search, the refresh() method was reloading
information from the issues API, which would lead to some information
not being refreshed properly, typically the mergeable state.

Related to hub4j#1779 (comment)
@gsmet
Copy link
Contributor Author

gsmet commented Mar 9, 2024

@bitwiseman I created 3 PRs to fix some issues with GHPullRequest API behavior.

There might be some conflicts given I added some tests to the same place but they should be easy to fix.
If you prefer, I can bundle the commits in one single PR but I thought it would be better for release notes to keep them separated.

Copy link

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.69%. Comparing base (1aa7178) to head (8bc0bfc).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1810      +/-   ##
============================================
+ Coverage     80.66%   80.69%   +0.02%     
  Complexity     2342     2342              
============================================
  Files           220      220              
  Lines          7082     7085       +3     
  Branches        379      378       -1     
============================================
+ Hits           5713     5717       +4     
  Misses         1132     1132              
+ Partials        237      236       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 911 to 912
// wait a bit for the mergeable state to get populated
Thread.sleep(5000);
Copy link
Member

Choose a reason for hiding this comment

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

Please implement await() in some form instead of hard sleeps. Waiting is only needed when recording, not during CI tests.

https://github.com/hub4j/github-api/blob/main/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java#L574-L584

Copy link
Member

Choose a reason for hiding this comment

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

This is broader problem. Filed #1815.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree on that. I actually asked myself that and saw that there was some Thread.sleep calls above so I supposed we decided to live with them. I'll try to find some cycles to clean this up.

Copy link
Member

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

The thread sleeps are a broader problem. If you want to switch to await, cool. If not, merge freely.

@bitwiseman bitwiseman merged commit 0fac2a9 into hub4j:main Mar 11, 2024
11 checks passed
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.

2 participants