Skip to content

[Workloads] Improve logic for getting games to close in matchmaking workload #38

@dtest

Description

@dtest

The query to get a random open game to be closed looks something like this:

query := fmt.Sprintf("SELECT gameUUID FROM (SELECT gameUUID FROM games WHERE finished IS NULL ORDER BY created DESC LIMIT 10) TABLESAMPLE RESERVOIR (%d ROWS)", 1)

These random queries are too expensive in terms of CPU, especially as the games table grows. Additionally, this is called very frequently.

It would be better to improve the generator logic to get a list of 100-1000 open games to store in a queue. When the queue is empty, another call to get more games to close is issued to the backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions