You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//@todo when arg.ServerId server is down, user could be reconnect other serverId but msg in queue no consumetask.pushSingleToConnect(arg.ServerId, arg.UserId, arg.Msg)
Activity
LockGit commentedon Apr 21, 2023
由于目标serverId故障,当前用户触发重连,可能连接到了其他的serverId上,这个时候msg要去往的serverId是要改变的。
应该弄一个获取当前userId此刻在那个serverId上的方法即可,这样投递出去的消息是可达的
UsherFall commentedon Apr 21, 2023
那比我想象的复杂好多,,这等于需要让connect的服务保持可用性?我看起来userId和serverId还是对应的关系
UsherFall commentedon Apr 22, 2023
再看了下发现昨天想错了!好像也没那么难,如果当前userId因为connect服务失效断开连接,然后再自主地去另一个connect服务身份认证的话,会把userId和serverId组成键值放到redis里。那这样的话在下面这个错误处理里再根据userId拿到serverId就可以了
但又有点太简单,是差了啥东西吗
LockGit commentedon Apr 22, 2023
不使用默认的arg.ServerId ===> 根据userId和serverId的映射关系取最新的应该是哪个serverId
UsherFall commentedon Apr 22, 2023
看不太懂,我理解是redis用string类型存userId和serverId的对应关系,那只要用userId去查询拿到的应该就是userId对应的最新的serverId
LockGit commentedon Apr 22, 2023
是这个意思
UsherFall commentedon Apr 22, 2023
LockGit commentedon Apr 22, 2023
可以,作为补偿机制吧
UsherFall commentedon Apr 22, 2023
@LockGit 这个需要提个pr吗,要的话我测试下
LockGit commentedon Apr 24, 2023
可以提