This commit is contained in:
eson 2023-08-02 19:08:44 +08:00
parent fe51e85983
commit b73f846b7f

View File

@ -45,9 +45,9 @@ type SharedState struct {
nh *dragonboat.NodeHost nh *dragonboat.NodeHost
} }
func (fsm *SharedState) GetUserState(Userid int64) (us *UserState, err error) { func (ss *SharedState) GetUserState(Userid int64) (us *UserState, err error) {
ius, err := nh.SyncRead(context.TODO(), fsm.shardID, Userid) ius, err := ss.nh.SyncRead(context.TODO(), ss.shardID, Userid)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
return nil, err return nil, err
@ -62,9 +62,9 @@ func (fsm *SharedState) GetUserState(Userid int64) (us *UserState, err error) {
Key: Userid, Key: Userid,
} }
cs := nh.GetNoOPSession(128) cs := ss.nh.GetNoOPSession(128)
err = cmd.Encode(func(buf []byte) error { err = cmd.Encode(func(buf []byte) error {
result, err := nh.SyncPropose(context.TODO(), cs, buf) result, err := ss.nh.SyncPropose(context.TODO(), cs, buf)
if err != nil { if err != nil {
return err return err
} }