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

Use embedded buildmap in Netkan #2812

Merged
merged 1 commit into from
Jun 27, 2019

Conversation

HebaruSan
Copy link
Member

Problem

As of #2808, we now load the remote build map every time netkan.exe runs in order to validate that generated metadata matches at least one known game version. This means that per bot pass, we download https://raw.githubusercontent.com/KSP-CKAN/CKAN-meta/master/builds.json 1800 times. This is much more frequent than necessary considering that weeks or months typically pass between KSP versions.

Changes

Now KspBuildMap is rearranged to allow client code to choose the Remote, Cached, or Embedded build map. The default is the same as before: load Cached with Remote and then Embedded as fallbacks if nothing special is done, otherwise load Remote with Cached and then Embedded as fallbacks if Refresh is called. However, now there's also the option to only load the Embedded build map, which is used in the Netkan game version validator. This will reduce network usage by the bot.

Fixes #2809.

@HebaruSan HebaruSan added Easy This is easy to fix Pull request Netkan Issues affecting the netkan data Network Issues affecting internet connections of CKAN labels Jun 26, 2019
@techman83
Copy link
Member

I am probably missing something, but where does the build map get embedded for NetKAN?

@HebaruSan
Copy link
Member Author

HebaruSan commented Jun 27, 2019

It's included in the core csproj:

CKAN/Core/CKAN-core.csproj

Lines 151 to 153 in c3ed4b3

<ItemGroup>
<EmbeddedResource Include="builds.json" />
</ItemGroup>

https://github.com/KSP-CKAN/CKAN/blob/master/Core/builds.json

The result is that both ckan.exe and netkan.exe end up with an internal copy of builds.json that is current as of when they were compiled. The downside is that if you use an old executable it may get out of date (hence the preference for the remote build map), but for netkan.exe as used by the bot this is a non-issue because mechanisms to keep netkan.exe up to date are and will be in place.

@techman83
Copy link
Member

Ok, that's awesome and the rest LGTM!

@techman83 techman83 merged commit 1e1e3f7 into KSP-CKAN:master Jun 27, 2019
@HebaruSan HebaruSan deleted the fix/netkan-embedded-build-map branch June 27, 2019 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy This is easy to fix Netkan Issues affecting the netkan data Network Issues affecting internet connections of CKAN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Avoid Spurious build.json download in NetKAN
2 participants