googleforgames / open-match

Flexible, extensible, and scalable video game matchmaking.
http://open-match.dev
Apache License 2.0
3.18k stars 335 forks source link

Open Match automatically cleans up leftover tickets #1518

Open kazshinohara opened 1 year ago

kazshinohara commented 1 year ago

Is your feature request related to a problem? Please describe. At present, Open Match users need to clean up the leftover tickets by themselves, which were not used for matchmaking.

Describe the solution you'd like A couple of ideas here.

  1. Add paramters to CreateTicketRequest API so that users can specify the lifetime of ticket. Open Match regularly cleans up the leftover tickets according to the user-defined lifetime.

  2. Have a new API so that users can ask Open Match to regularly clean up the leftover tickets according to the create_time in each Ticket and the lifetime which users specified through this new API

Describe alternatives you've considered One of my customers does this clearning up by CronJob & own scripts in K8s cluster.

Additional context N/A

MaxHayman commented 1 year ago

I would like there to be a "LastAccessed" time so we can use a heartbeat type system. So I can say if the ticket was last checked 30+s ago I can assume they've disconnected.

castaneai commented 1 year ago

Hi, I have created a simple container image as a small workaround to this problem.

https://github.com/castaneai/omtools/pkgs/container/omtools%2Fom-ticket-cleaner

The following example is a k8s CronJob that periodically deletes tickets that are more than 10 minutes old.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: om-ticket-cleaner
  namespace: open-match
spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: om-ticket-cleaner
              image: ghcr.io/castaneai/omtools/om-ticket-cleaner:latest
              args:
                - "x.x.x.x:6379"
                - "10m"
          restartPolicy: OnFailure