github.com/Laplace-Game-Development/Laplace-Entangled-Environment@v0.0.3/internal/event/event.go (about) 1 // The Event module represents the possible tasks a command can submit 2 // to be done outside of the request response loop. 3 // This majorly includes garbage collecting for old/unused games. 4 package event 5 6 import ( 7 "github.com/Laplace-Game-Development/Laplace-Entangled-Environment/internal/redis" 8 "github.com/mediocregopher/radix/v3" 9 ) 10 11 //// Table / Datastructure Names 12 13 // Name of Redis Key Storing the Health Tasks 14 const HealthTaskQueue string = "healthTaskQueue" 15 16 /////////////////////////////////////////////////////////////////////////////////////////////////// 17 //// 18 //// Tasks Submissions -- Public Interface Functions 19 //// 20 /////////////////////////////////////////////////////////////////////////////////////////////////// 21 22 // Submits a perspective game ID to be added to the Game Health Check scheduled tasks in redis. 23 // 24 // gameID :: string gameID as the unique identifier in the games Hash Tables in Redis. 25 // 26 // returns -> error if we are unable to submit the id to the database. nil otherwise. 27 func SubmitGameForHealthCheck(gameID string) error { 28 err := redis.MainRedis.Do(radix.Cmd(nil, "RPUSH", HealthTaskQueue, gameID)) 29 if err != nil { 30 return err 31 } 32 33 return nil 34 }