Upload on leave while an unconfirmed prefetched copy is held

The leave handler skipped the upload for any active download, including a
prefetched copy no join had confirmed, which has replaced nothing here. Newer
local data, such as after a failed upload whose retry the join cleared, was then
never uploaded. Only a real download skips it now; a copy whose join took the
body still uploads nothing through sync_in_progress.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ILLISISandClaude Opus 5.5 committed 2026-10-20 13:19:29 +11:00
1 parent 3f79cdb1a6
commit 0149c72639
1 file changed
+9 -4
+9 -4
View File
@@ -583,10 +583,15 @@ player_sync.events[defines.events.on_pre_player_left_game] = function(event)
local destination = player_record.destination
player_record.destination = nil
-- If player has an active download release our acquisition but let the download continue
if script_data.active_downloads[player.name] then
-- A prefetched copy is confirmed per join: the next join's acquire reply confirms it again
script_data.active_downloads[player.name].confirmed = nil
local download = script_data.active_downloads[player.name]
if download and download.prefetch then
-- A prefetched copy is confirmed per join: the next join's acquire reply confirms it again. Until then it has
-- replaced nothing here, so the checks below decide the upload. One whose join took the body (spectate) left
-- sync_in_progress set, and uploads nothing.
download.confirmed = nil
elseif download then
-- If player has an active download release our acquisition but let the download continue
clusterio_api.send_json("player_sync_release", { player_name = player.name })
return
end