Skip to content

Commit

Permalink
Make new_run return a string instead of an ObjectId.
Browse files Browse the repository at this point in the history
The convention throughout the code base is that run_id is a
string.

Since a run_id and the corresponding ObjectId print in
exactly the same way, violating this convention may lead to
hard to understand bugs such as this one

https://tests.stockfishchess.org/actions?action=log_message&user=&text=internal

which was introduced in #1993.
  • Loading branch information
vdbergh authored and ppigazzini committed Jul 1, 2024
1 parent 31cd991 commit 0dfaa97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,10 @@ def new_run(
raise Exception(message)

# We cannot use self.buffer since new_run does not have an id yet.
run_id = self.runs.insert_one(new_run).inserted_id
run_id = str(self.runs.insert_one(new_run).inserted_id)

with self.unfinished_runs_lock:
self.unfinished_runs.add(str(run_id))
self.unfinished_runs.add(run_id)

return run_id

Expand Down

0 comments on commit 0dfaa97

Please sign in to comment.