monument
monument copied to clipboard
`DOWNLOADS` cache ignores the destination file, causing issue if mulitple download operations use a same download url
https://github.com/skyrising/monument/blob/a29e1a80860dd2515db761e516c3507796ebee0c/src/main/kotlin/de/skyrising/guardian/gen/files.kt#L17-L21
Issue at: DOWNLOADS.computeIfAbsent(url) ignores the file parameter
To reproduce
- Define a branch container both mc 1.20.3 and mc 1.20.4, using mojang mapping
- 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:
- https://github.com/skyrising/mc-versions/blob/351a09651cc4c8019a7d46c956b55369e6e5675e/data/version/1.20.3.json#L4-L25
- https://github.com/skyrising/mc-versions/blob/351a09651cc4c8019a7d46c956b55369e6e5675e/data/version/1.20.4.json#L4-L24
Example fix
private val DOWNLOADS = ConcurrentHashMap<Pair<URI, Path>, CompletableFuture<Unit>>()