Fix: test; limit changes on player update
This commit is contained in:
@ -24,57 +24,6 @@ func createRoom(ctx context.Context, req *models.RoomReq) (*models.Room, error)
|
||||
return room, nil
|
||||
}
|
||||
|
||||
// // DEPRECATED
|
||||
// func saveRoom(room *models.Room) error {
|
||||
// key := models.CacheRoomPrefix + room.ID
|
||||
// data, err := json.Marshal(room)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// memcache.Set(key, data)
|
||||
// // do I need last action here? since room save is kind of an action on itself
|
||||
// // time.Now().Add(time.Hour).Sub(room.LastActionTS)
|
||||
// anHour := int64(216000) // 60 * 60 * 60
|
||||
// memcache.Expire(key, anHour)
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// func getRoomByID(roomID string) (*models.Room, error) {
|
||||
// roomBytes, err := memcache.Get(models.CacheRoomPrefix + roomID)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// resp := &models.Room{}
|
||||
// if err := json.Unmarshal(roomBytes, &resp); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return resp, nil
|
||||
// }
|
||||
|
||||
// func removeRoom(roomID string) {
|
||||
// key := models.CacheRoomPrefix + roomID
|
||||
// memcache.RemoveKey(key)
|
||||
// }
|
||||
|
||||
// context
|
||||
|
||||
// func getStateByCtx(ctx context.Context) (*models.UserState, error) {
|
||||
// username, ok := ctx.Value(models.CtxUsernameKey).(string)
|
||||
// if !ok {
|
||||
// log.Debug("no username in ctx")
|
||||
// return &models.UserState{}, errors.New("no username in ctx")
|
||||
// }
|
||||
// us, err := loadState(username)
|
||||
// if err != nil {
|
||||
// return &models.UserState{}, err
|
||||
// }
|
||||
// return us, nil
|
||||
// }
|
||||
|
||||
// func dbCreate(fi *models.FullInfo) error{
|
||||
// repo.CreateRoom()
|
||||
// }
|
||||
|
||||
func saveFullInfo(ctx context.Context, fi *models.FullInfo) error {
|
||||
// INFO: no transactions; so case is possible where first object is updated but the second is not
|
||||
if err := repo.PlayerUpdate(ctx, fi.State); err != nil {
|
||||
|
Reference in New Issue
Block a user