Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deboer-tim
Copy link
Collaborator

The CDS will repeatedly download 'duplicate' images if the Contest API server says the file is different than what the CDS determines it to be after downloading. For example, if the server says it has an image that's 50x50, the CDS downloads it, and reads it as 51x51, then the next time you restart we'll have a 51x51 image, see that the source has a 'different' one, and download it a second time. This will happen every time the CDS restarts, leading to many duplicate images.

The most obvious solution is to fix the bug in determining image size or file reference data in the CDS or the upstream server, but that takes time and is hard to track down, so this just starts by logging whenever this occurs to make it easier to track. In the future this code would make it easy to take the next step and delete the file after download, but I want to run it in a few contests before making that step. This change:

  • Moves the logic of whether a file reference matches an existing one from PlaybackContest to FileReferenceList.
  • Exposes the local file cache information from DiskContestSource.
  • After downloading in RestContestSource, check if the file matches one we already have.

Most of #1125.

The CDS will repeatedly download 'duplicate' images if the Contest API server
says the file is different than what the CDS determines it to be after
downloading. For example, if the server says it has an image that's 50x50,
the CDS downloads it, and reads it as 51x51, then the next time you restart
we'll have a 51x51 image, see that the source has a 'different' one, and
download it a second time. This will happen every time the CDS restarts,
leading to many duplicate images.

The most obvious solution is to fix the bug in determining image size or
file reference data in the CDS or the upstream server, but that takes time
and is hard to track down, so this just starts by logging whenever this
occurs to make it easier to track. In the future this code would make it
easy to take the next step and delete the file after download, but I want
to run it in a few contests before making that step. This change:

- Moves the logic of whether a file reference matches an existing one from
  PlaybackContest to FileReferenceList.
- Exposes the local file cache information from DiskContestSource.
- After downloading in RestContestSource, check if the file matches one we
  already have.

Most of icpctools#1125.
@deboer-tim deboer-tim merged commit 91cb6e8 into icpctools:main Jul 30, 2025
4 checks passed
@deboer-tim deboer-tim deleted the download-dupe branch July 31, 2025 12:23
deboer-tim added a commit to deboer-tim/icpctools that referenced this pull request Jul 31, 2025
The fix in icpctools#1152 fails in many cases due to a casting issue passing a list to
FileReferenceList. Fixes that by adding the objects manually.

Also noticed an NPE when a team name is null. Won't happen in a real contest,
but currently exists in baku data.
deboer-tim added a commit that referenced this pull request Jul 31, 2025
The fix in #1152 fails in many cases due to a casting issue passing a list to
FileReferenceList. Fixes that by adding the objects manually.

Also noticed an NPE when a team name is null. Won't happen in a real contest,
but currently exists in baku data.
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.

2 participants