Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
SERVER_VERSION = "1.3.68"
SERVER_VERSION = "1.3.69"

# TODO: fetch from GitHub tags
OLD_VERSION = '2.20.0'
Expand Down Expand Up @@ -1612,7 +1612,11 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
packageIndex = 0
if os.path.isfile('package-index.txt'):
with open('package-index.txt', 'rt') as f:
packageIndex = int(f.read())
# TODO: the file might be empty - fixture out how this might happen
try:
packageIndex = int(f.read())
except ValueError as e:
logging.error("failed to convert package index to int", exc_info=sys.exc_info())
Copy link
Copy Markdown
Collaborator

@danmar danmar Apr 26, 2026

Choose a reason for hiding this comment

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

If reading the file fails I would suggest that we set the default value packageIndex = int(time.time()) % len(packages)

that way if the file gets corrupt frequently we will still analyze files here and there and don't always start from 0. It's not perfect but better imho.

if packageIndex < 0 or packageIndex >= len(packages):
packageIndex = 0

Expand Down
Loading