kneasle / wheatley

An AI for Ringing Room that can ring any number of bells to increase the scope of practices.
https://pypi.org/project/wheatley/
MIT License
15 stars 13 forks source link

Fix `next_row_generator` race condition #219

Closed kneasle closed 1 year ago

kneasle commented 1 year ago

This fixes a bug where Bot.next_row_generator_lock was not held when loading the Bot.next_row_generator for a new touch. This meant that, if the next_row_generator were to take more than a few milliseconds to load, the main thread wouldn't wait for the loading to finish and would blindly read the old value of Bot.next_row_generator.

Downloading a peal-length composition from CompLib takes ~300ms, which is enough to consistently trigger this race condition. Therefore, this fix is required for compositions to work in Ringing Room.