kopia lustrzana https://github.com/cyoung/stratux
rodzic
72d989ed3b
commit
e6ad9aa830
|
@ -186,7 +186,7 @@ func refreshConnectedClients() {
|
||||||
|
|
||||||
func messageQueueSender() {
|
func messageQueueSender() {
|
||||||
secondTimer := time.NewTicker(5 * time.Second)
|
secondTimer := time.NewTicker(5 * time.Second)
|
||||||
queueTimer := time.NewTicker(1 * time.Second)
|
queueTimer := time.NewTicker(100 * time.Millisecond)
|
||||||
|
|
||||||
var lastQueueTimeChange time.Time // Reevaluate send frequency every 5 seconds.
|
var lastQueueTimeChange time.Time // Reevaluate send frequency every 5 seconds.
|
||||||
for {
|
for {
|
||||||
|
@ -215,7 +215,7 @@ func messageQueueSender() {
|
||||||
averageSendableQueueSize = averageSendableQueueSize / float64(len(outSockets)) // It's a total, not an average, up until this point.
|
averageSendableQueueSize = averageSendableQueueSize / float64(len(outSockets)) // It's a total, not an average, up until this point.
|
||||||
pd = math.Max(float64(1.0/2500.0), float64(1.0/(4.0*averageSendableQueueSize))) // Say 250ms is enough to get through the whole queue.
|
pd = math.Max(float64(1.0/2500.0), float64(1.0/(4.0*averageSendableQueueSize))) // Say 250ms is enough to get through the whole queue.
|
||||||
} else {
|
} else {
|
||||||
pd = float64(1.0 / 2500.0)
|
pd = float64(1.0 / 0.1) // 100ms.
|
||||||
}
|
}
|
||||||
queueTimer.Stop()
|
queueTimer.Stop()
|
||||||
queueTimer = time.NewTicker(time.Duration(pd*1000000000.0) * time.Nanosecond)
|
queueTimer = time.NewTicker(time.Duration(pd*1000000000.0) * time.Nanosecond)
|
||||||
|
|
Ładowanie…
Reference in New Issue