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

Handle multiple download URLs per module #306

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Aug 9, 2023

Motivation

As of KSP-CKAN/CKAN#3877 and the next release of the CKAN client, it will be possible for the download property to contain a list of multiple URLs. A few places in the Infra assume it will be a single value.

Changes

  • The existing Ckan.download property is updated to preserve backwards compatibility by always returning the first URL if there are multiple. This will ensure that all old code using this property will continue to work as previously. For example, the Mirrorer doesn't really need to check multiple URLs to do its job, so it will continue using this property.
  • A new Ckan.downloads property is added that always returns a list, which includes the archive.org fallback URLs for modules that have them. The DownloadCounter is updated to use this property to count and sum all of the downloads for modules that have multiple URLs.

@HebaruSan HebaruSan added Enhancement New feature or request Download counts It's about the download counts gathering mechanism Mirrorer Uploads mods to archive.org labels Aug 9, 2023
@HebaruSan HebaruSan requested a review from techman83 August 9, 2023 15:56
@HebaruSan HebaruSan force-pushed the feature/download-list branch 3 times, most recently from 9e54d4b to 323c842 Compare August 9, 2023 16:46
@HebaruSan
Copy link
Member Author

HebaruSan commented Aug 9, 2023

I don't know what's wrong with the Coverage check, but it doesn't look like it's related to these changes.
See orgoro/coverage#259; something about the GitHub token's permissions?

I meant to push 75acc13 to this branch but accidentally put it on master instead. 😳

@HebaruSan HebaruSan force-pushed the feature/download-list branch 2 times, most recently from 4f58f18 to 0e76896 Compare August 9, 2023 17:37
Copy link
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

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

Really only some minor feedback, looks like the coverage action is currently a bit busted. It is actually reporting the coverage, but maybe GitHub have changed something in terms of scoping the permissions.

If you'd like I can add some branch protection rules? We can still override them when required, but gives the ability to avoid accidentally pushing

netkan/netkan/download_counter.py Outdated Show resolved Hide resolved
netkan/netkan/download_counter.py Outdated Show resolved Hide resolved
netkan/netkan/download_counter.py Outdated Show resolved Hide resolved
Copy link
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

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

Awesome, thanks @HebaruSan !

@techman83
Copy link
Member

We can fix the coverage separately, it's failing for issues unrelated to this PR

@techman83 techman83 merged commit c26b145 into KSP-CKAN:master Aug 11, 2023
@HebaruSan HebaruSan deleted the feature/download-list branch August 11, 2023 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Download counts It's about the download counts gathering mechanism Enhancement New feature or request Mirrorer Uploads mods to archive.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants