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

DOWNLOADS cache ignores the destination file, causing issue if mulitple download operations use a same download url #2

Open
Fallen-Breath opened this issue Dec 12, 2024 · 0 comments

Comments

@Fallen-Breath
Copy link

private val DOWNLOADS = ConcurrentHashMap<URI, CompletableFuture<Unit>>()
fun download(url: URI, file: Path, listener: ((DownloadProgress) -> Unit)? = null) = DOWNLOADS.computeIfAbsent(url) {
startDownload(it, file, listener)
}

Issue at: DOWNLOADS.computeIfAbsent(url) ignores the file parameter

To reproduce

  1. Define a branch container both mc 1.20.3 and mc 1.20.4, using mojang mapping
  2. Run the monument

Expected behavior

Both mc 1.20.3 and mc 1.20.4 have their mojang mapping.txt downloaded successfully

Actual behavior

Only the first download attempts to the mapping.txt will succeed

Reason: mc1.20.3 and mc1.20.4 use the same mapping.txt, causing the issue that the later download attempt will be skipped (due to the computeIfAbsent) call

More information on the same server_mappings and client_mappings:

Example fix

private val DOWNLOADS = ConcurrentHashMap<Pair<URI, Path>, CompletableFuture<Unit>>()
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

No branches or pull requests

1 participant