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

refactor: restructured download logic (wip) #1432

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

warber
Copy link
Contributor

@warber warber commented Mar 22, 2024

What this PR does / Why we need it:

Refactored download logic a bit to avoid additional if statement to handle web key user actions.

Special notes for your reviewer:

Does this PR introduce a user-facing change?

@warber warber requested a review from a team as a code owner March 22, 2024 07:42
@warber warber changed the title refactor: restructured downloadAndUnmarshalConfig logic refactor: restructured download logic Mar 22, 2024
Copy link

github-actions bot commented Mar 22, 2024

Unit Test Results

1 853 tests  ±0   1 853 ✅ ±0   26s ⏱️ ±0s
  131 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit caa02dd. ± Comparison against base commit 80c3b95.

♻️ This comment has been updated with latest results.

@warber warber marked this pull request as draft March 22, 2024 08:02
@warber warber marked this pull request as ready for review March 22, 2024 10:43
@warber warber marked this pull request as draft March 22, 2024 12:23
@warber warber force-pushed the refactor/cleanup-download branch 3 times, most recently from f99a993 to 165811c Compare March 26, 2024 15:18
@warber warber changed the title refactor: restructured download logic refactor: restructured download logic (wip) Mar 27, 2024
@warber warber force-pushed the refactor/cleanup-download branch 2 times, most recently from de38282 to e2198df Compare April 2, 2024 15:36
Copy link
Contributor

@jskelin jskelin left a comment

Choose a reason for hiding this comment

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

Better that it was.

jskelin
jskelin previously approved these changes Apr 3, 2024
@warber warber force-pushed the refactor/cleanup-download branch from e2198df to 8e32d3c Compare April 3, 2024 16:48
@warber warber force-pushed the refactor/cleanup-download branch 2 times, most recently from 2f2003e to f3796c0 Compare April 10, 2024 10:40
@UnseenWizzard
Copy link
Collaborator

Overall I find it easier to follow to than before, but the mixture of "normal" config APIs types where this downloading will download and unmarshal single objects and things like kua-web where downloading will get and create several entries (and resolves parent API) makes it still a bit hard to follow. Some explanatory comments on the functions would be nice.

go func() {
defer wg.Done()

downloadedJsons, err := downloadAndUnmarshalConfig(client, api, v)
dlData, err := download(client, api, v)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You didn't introduce this @warber, but: we capture the config to download v in the loop and go routine, rather than passing it as a variable to the go func. This seems not to have caused issues so far - but couldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't that only a problem for go <1.22 ?

@warber
Copy link
Contributor Author

warber commented Apr 17, 2024

Overall I find it easier to follow to than before, but the mixture of "normal" config APIs types where this downloading will download and unmarshal single objects and things like kua-web where downloading will get and create several entries (and resolves parent API) makes it still a bit hard to follow. Some explanatory comments on the functions would be nice.

@UnseenWizzard yes i know 😿 if you have any further ideas, feel free to give it a try :)

@warber warber force-pushed the refactor/cleanup-download branch 3 times, most recently from 7041663 to 2cb06ca Compare April 23, 2024 10:48
@warber warber force-pushed the refactor/cleanup-download branch 2 times, most recently from 29f3eba to 954f51a Compare May 6, 2024 17:16
@warber warber force-pushed the refactor/cleanup-download branch from 954f51a to 414263c Compare May 7, 2024 13:43
@warber warber force-pushed the refactor/cleanup-download branch from 414263c to 185480d Compare June 4, 2024 08:18
This function is now split into two.
Further, no special treatment to find matching key user action is needed as it is generally done via the CheckEqualFunc.
@warber warber force-pushed the refactor/cleanup-download branch from 185480d to caa02dd Compare June 7, 2024 12:41
Copy link

sonarcloud bot commented Jun 7, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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.

None yet

3 participants