Commit 26476177 authored by AlexStocks's avatar AlexStocks Committed by watermelo

Imp: enlarge time wheel span from 2m to 15m

parent b438b286
This diff is collapsed.
......@@ -24,9 +24,9 @@ import (
import (
"github.com/dubbogo/gost/bytes"
"github.com/dubbogo/gost/net"
"github.com/gorilla/websocket"
perrors "github.com/pkg/errors"
"github.com/dubbogo/gost/net"
)
const (
......
......@@ -23,9 +23,9 @@ import (
)
import (
"github.com/dubbogo/gost/net"
"github.com/gorilla/websocket"
perrors "github.com/pkg/errors"
"github.com/dubbogo/gost/net"
)
var (
......
......@@ -30,12 +30,14 @@ import (
)
const (
maxReadBufLen = 4 * 1024
netIOTimeout = 1e9 // 1s
period = 60 * 1e9 // 1 minute
pendingDuration = 3e9
defaultQLen = 1024
maxIovecNum = 10
maxReadBufLen = 4 * 1024
netIOTimeout = 1e9 // 1s
period = 60 * 1e9 // 1 minute
pendingDuration = 3e9
defaultQLen = 1024
maxIovecNum = 10
MaxWheelTimeSpan = 900e9 // 900s, 15 minute
defaultSessionName = "session"
defaultTCPSessionName = "tcp-session"
defaultUDPSessionName = "udp-session"
......@@ -49,9 +51,15 @@ const (
/////////////////////////////////////////
var (
wheel = gxtime.NewWheel(gxtime.TimeMillisecondDuration(100), 1200) // wheel longest span is 2 minute
wheel *gxtime.Wheel
)
func init() {
span := 100e6 // 100ms
buckets := MaxWheelTimeSpan / span
wheel = gxtime.NewWheel(time.Duration(span), int(buckets)) // wheel longest span is 15 minute
}
func GetTimeWheel() *gxtime.Wheel {
return wheel
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment