kwokwilliam / questionqueue

QuestionQueue for INFO 441 Final Project (for the time being)
0 stars 0 forks source link

redis: can't marshal interface{} #18

Closed bryoco closed 5 years ago

bryoco commented 5 years ago

In src/session/redisstore.go

func (rs *RedisStore) SetQueue(sid SessionID, sessionState interface{}) error {

    pipeline := rs.Client.Pipeline()
    // do not expire queue
    pipe := pipeline.Set(string(sid), sessionState, 0)

    if _, err := pipeline.Exec(); err != nil {
        // TODO: redis: can't marshal []string <----------------------------------------------------
        log.Println("redis cannot exec command")
        return err
    }

    if s, err := pipe.Result(); err != nil {
        return err
    } else {
        // TODO: remove me
        log.Println("pipeline.Result:",s)
        if err = json.Unmarshal([]byte(s), sessionState); err != nil {
            // cannot unmarshal
            return err
        } else {
            return nil
        }
    }
}
bryoco commented 5 years ago

TODO: Is this a pipeline issue?