Skip to content

fix map download and scynchronizaiton#3053

Merged
Licho1 merged 4 commits into
masterfrom
fix_map_synchro
May 9, 2026
Merged

fix map download and scynchronizaiton#3053
Licho1 merged 4 commits into
masterfrom
fix_map_synchro

Conversation

@Licho1
Copy link
Copy Markdown
Member

@Licho1 Licho1 commented May 9, 2026

Fixes #3051 — featured maps no longer randomly lose their downloads. The old ResourceLinkProvider.UpdateLinks did a 2 s HEAD against /content/maps/<file> on every periodic refresh and valids.Remove(link) on any failure (timeout / momentary 404 / IIS hiccup), zeroing LinkCount. The rewrite uses live File.Exists per request for the local URL (never silently destroyed) and a 24 h cached, deduped HEAD probe for the springfiles fallback.

Fixes #3052 — case-insensitive FileName match in MapsController.UploadResource, plus null-guards on the resource/contentFile lookups so old maps with mismatched-casing filenames no longer NPE the upload.

Other changes

  • Switched the springfiles bulk syncer to the JSON catalog at springfiles.springrts.com/json.php (the old api.springfiles.com is dead).
  • After successful registration / for already-registered-but-missing maps, the syncer now copies into ~/content/maps/ so the local mirror is populated.
  • Added GlobalConst.SpringfilesBaseUrl to centralize the host.
  • Probe dedup via ConcurrentDictionary<string, Lazy<bool>> — verified that 30 (and 100) concurrent cold-cache callers result in exactly one HEAD.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates how map download links are generated and how the AutoRegistrator syncs/copies maps from springfiles so registered maps are available locally under content/maps for web downloads.

Changes:

  • Replaces legacy “mirror list + link validation” logic with a simpler “local file + springfiles availability” link builder (with caching/deduped probing).
  • Adds GlobalConst.SpringfilesBaseUrl and removes the old DefaultDownloadMirrors mechanism.
  • Reworks the springfiles map syncer to use the springfiles JSON API and to copy successfully registered maps into the site content/maps folder.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
Zero-K.info/AppCode/ResourceLinkProvider.cs New link-building + springfiles HEAD-probe caching/dedup logic for resource downloads.
Shared/PlasmaShared/GlobalConst.cs Introduces SpringfilesBaseUrl constant and removes obsolete download-mirror plumbing.
AutoRegistrator/WebFolderSync.cs Switches springfiles listing to JSON API and returns success/failure from downloads.
AutoRegistrator/AutoRegistrator.cs Updates map synchronization flow to ensure registered maps exist locally in content/maps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Zero-K.info/AppCode/ResourceLinkProvider.cs Outdated
Comment thread Zero-K.info/AppCode/ResourceLinkProvider.cs Outdated
Comment thread Zero-K.info/AppCode/ResourceLinkProvider.cs
Comment thread AutoRegistrator/WebFolderSync.cs
Comment thread AutoRegistrator/AutoRegistrator.cs Outdated
Licho1 added 3 commits May 9, 2026 14:34
Case-insensitive FileName match in UploadResource — DB row may have
different casing than the freshly-uploaded file (e.g., springfiles vs
original-upload casing). Plus null-guards on the resource and contentFile
lookups so a missing match logs gracefully instead of NPEing.
@Licho1 Licho1 enabled auto-merge (squash) May 9, 2026 12:46
@Licho1 Licho1 disabled auto-merge May 9, 2026 12:46
@Licho1 Licho1 merged commit b932a06 into master May 9, 2026
2 checks passed
@Licho1 Licho1 deleted the fix_map_synchro branch May 9, 2026 12:47
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.

Unable to reup downloads for multiple supported maps. [MAJOR] Featured Map Downloads randomly dying

2 participants