Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix matchmaking bug with concurrency set to 0 #1004

Merged
merged 2 commits into from
Aug 10, 2024

Conversation

AttackingOrDefending
Copy link
Member

Type of pull request:

  • Bug fix
  • Feature
  • Other

Description:

The matchmaker would challenge other bots even when concurrency was set to 0, leading to the problems described in #1003. This PR fixes this.

Related Issues:

#1003

Checklist:

  • I have read and followed the contribution guidelines.
  • I have added necessary documentation (if applicable).
  • The changes pass all existing tests.

Screenshots/logs (if applicable):

@MarkZH
Copy link
Collaborator

MarkZH commented Aug 10, 2024

So, after this fix, setting challenge: concurrency: 0 results in no challenges being sent or accepted. In other words, the bot does nothing. Should we print a warning and exit in this case?

@MarkZH
Copy link
Collaborator

MarkZH commented Aug 10, 2024

Something like this in config.py:

config_assert(CONFIG["challenge"]["concurrency"] > 0, "challenge.concurrency must be greater than zero to play any games.")

@AttackingOrDefending
Copy link
Member Author

I used config_warn instead of config_assert because setting concurrency to 0 has some possible uses:

  1. The bot's owner can create challenges through the lichess website and the bot will play the games (useful for testing).
  2. After restarting lichess-bot, when you want your bot to just finish all the already started games.

@AttackingOrDefending
Copy link
Member Author

Also, just to note, it is still possible to make a bot not accept any challenges but still create ones, by setting min_base to a value larger than max_base (e.g. 60 when max_base is 30).

@MarkZH
Copy link
Collaborator

MarkZH commented Aug 10, 2024

I used config_warn instead of config_assert because setting concurrency to 0 has some possible uses:

  1. The bot's owner can create challenges through the lichess website and the bot will play the games (useful for testing).

  2. After restarting lichess-bot, when you want your bot to just finish all the already started games.

Point 1 makes sense. For point 2, the user can set quit_after_all_games_finish: true.

Also, just to note, it is still possible to make a bot not accept any challenges but still create ones, by setting min_base to a value larger than max_base (e.g. 60 when max_base is 30).

This should probably have a warning, as well as any other configuration with min_ and max_. But, that can be another PR.

@MarkZH MarkZH merged commit 041dc69 into lichess-bot-devs:master Aug 10, 2024
15 checks passed
@MarkZH MarkZH mentioned this pull request Aug 10, 2024
6 tasks
@AttackingOrDefending AttackingOrDefending deleted the matchmaking branch August 11, 2024 05:54
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