Enha: tx for cron
This commit is contained in:
@ -47,41 +47,9 @@ func notifyBotIfNeeded(room *models.Room) {
|
||||
}
|
||||
}
|
||||
|
||||
// cache
|
||||
|
||||
// func saveState(username string, state *models.UserState) error {
|
||||
// key := models.CacheStatePrefix + username
|
||||
// data, err := json.Marshal(state)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// memcache.Set(key, data)
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// func getAllNames() []string {
|
||||
// names := []string{}
|
||||
// // will not scale
|
||||
// session := &models.Session{}
|
||||
// // filter by key size only sessions
|
||||
// for _, name := range wholeMemStore {
|
||||
// // xid is 20 in len
|
||||
// if len(k) != 20 {
|
||||
// continue
|
||||
// }
|
||||
// if err := json.Unmarshal(v, &session); err != nil {
|
||||
// log.Error("failed to unmarshal", "error", err)
|
||||
// continue
|
||||
// }
|
||||
// names = append(names, session.Username)
|
||||
// }
|
||||
// return names
|
||||
// }
|
||||
|
||||
// can room exists without state? I think no
|
||||
func getFullInfoByCtx(ctx context.Context) (*models.FullInfo, error) {
|
||||
resp := &models.FullInfo{}
|
||||
// state, err := getStateByCtx(ctx)
|
||||
state, err := getPlayerByCtx(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -251,7 +251,7 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func HandleJoinRoom(w http.ResponseWriter, r *http.Request) {
|
||||
roomID := r.URL.Query().Get("id")
|
||||
room, err := repo.RoomGetByID(r.Context(), roomID)
|
||||
room, err := repo.RoomGetExtended(r.Context(), roomID)
|
||||
if err != nil {
|
||||
abortWithError(w, err.Error())
|
||||
return
|
||||
|
Reference in New Issue
Block a user