fix: preserve cross-pod message order
This commit is contained in:
+4
-1
@@ -168,6 +168,9 @@ type Session struct {
|
||||
|
||||
// Type of proxy to master request being handled.
|
||||
proxyReq ProxyReqType
|
||||
// Ensures that one multiplexing session is drained by at most one cluster
|
||||
// write task at a time, preserving per-topic response order.
|
||||
clusterWriteScheduled atomic.Bool
|
||||
}
|
||||
|
||||
// Subscription is a mapper of sessions to topics.
|
||||
@@ -332,7 +335,7 @@ func (s *Session) isCluster() bool {
|
||||
}
|
||||
|
||||
func (s *Session) scheduleClusterWriteLoop() {
|
||||
if globals.cluster != nil && globals.cluster.proxyEventQueue != nil {
|
||||
if globals.cluster != nil && globals.cluster.proxyEventQueue != nil && s.clusterWriteScheduled.CompareAndSwap(false, true) {
|
||||
globals.cluster.proxyEventQueue.Schedule(
|
||||
func() { s.clusterWriteLoop(s.proxiedTopic) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user