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

Supporting metadata for matches #165

Open
mikhail opened this issue Apr 19, 2023 · 1 comment
Open

Supporting metadata for matches #165

mikhail opened this issue Apr 19, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mikhail
Copy link

mikhail commented Apr 19, 2023

I'm trying to use the library to manage concurrent matches being executed in parallel. Imagine multiple tables for ping pong, or multiple baseball fields, parallel curling sheets, etc etc.

I'm envisioning metadata for Match objects that specify some parameter such as location_id. Is this the right approach? Would you accept a PR for this?

Understandable if the right solution here is to manage location independently of this library. Let me know!

@Drarig29
Copy link
Owner

Drarig29 commented Apr 19, 2023

Understandable if the right solution here is to manage location independently of this library.

Yes, you're right. You should be handling this independently from the library 👍
When creating a stage, the library will create all the matches for you, by using the storage implementation you provided.

So if you implemented your own storage, you could add location_id on-the-fly. And the library won't know about it. For future match updates, the library will only do partial mutations of the matches, so your metadata will remain intact.

If you didn't implement a storage (or don't want to), you can use the in-memory storage implementation, add your metadata, then persist everything at once in your database. Or you should be able to create a new storage class which extends from JsonDatabase.

Manage concurrent matches being executed in parallel.

With this metadata, an approach would be to:

  • Get all the matches with Status.Ready (3), and execute one per location in parallel.
    • Note: You aren't forced to finish a round before starting the next one.
  • The matches that are executed in parallel are going to change to Status.Running (4).
  • Once a match is finished, it will update the status for the following matches automatically. At this moment, you can get all the matches with a Status.Ready (3) status again, and assign them to an available location.

@Drarig29 Drarig29 added wontfix This will not be worked on enhancement New feature or request and removed wontfix This will not be worked on labels Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants