perf(cmpp): process inbound submits within client window
This commit is contained in:
@@ -20,6 +20,7 @@ type Server struct {
|
||||
PresenceStore PresenceStore
|
||||
RecoveryStore RecoveryStore
|
||||
GatewayInstanceID string
|
||||
MaxSubmitConcurrency int
|
||||
}
|
||||
|
||||
func (s Server) ListenAndServe() error {
|
||||
@@ -30,9 +31,19 @@ func (s Server) ListenAndServe() error {
|
||||
s.logRecoveryCandidates(log.Default())
|
||||
go s.recoverPendingCandidates(log.Default())
|
||||
go s.runPendingFlusher(log.Default())
|
||||
return cmpp.ListenAndServeWithClose(addr, cmpp.V30, 30*time.Second, 3, s.LogWriter, s.handleConnectionClosed,
|
||||
return cmpp.ListenAndServeWithCloseAndSubmitWindow(addr, cmpp.V30, 30*time.Second, 3, s.LogWriter, s.handleConnectionClosed, submitWindowByConn,
|
||||
cmpp.HandlerFunc(s.handleLogin),
|
||||
cmpp.HandlerFunc(s.handleSubmit),
|
||||
cmpp.HandlerFunc(s.handleActivity),
|
||||
)
|
||||
}
|
||||
|
||||
func boundedSubmitWindow(applicationWindow int, gatewayMaximum int) int {
|
||||
if applicationWindow < 1 {
|
||||
applicationWindow = 1
|
||||
}
|
||||
if gatewayMaximum < 1 {
|
||||
gatewayMaximum = 64
|
||||
}
|
||||
return min(applicationWindow, min(gatewayMaximum, 1024))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user