mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
exempt a configurable number of MARKREAD commands from fakelag
This commit is contained in:
parent
7d6ff58bf8
commit
7ad31497c2
6 changed files with 59 additions and 12 deletions
|
|
@ -60,7 +60,7 @@ func TestFakelag(t *testing.T) {
|
|||
window, _ := time.ParseDuration("1s")
|
||||
fl, mt := newFakelagForTesting(window, 3, 2, window)
|
||||
|
||||
fl.Touch()
|
||||
fl.Touch("")
|
||||
slept, _ := mt.lastSleep()
|
||||
if slept {
|
||||
t.Fatalf("should not have slept")
|
||||
|
|
@ -69,7 +69,7 @@ func TestFakelag(t *testing.T) {
|
|||
interval, _ := time.ParseDuration("100ms")
|
||||
for i := 0; i < 2; i++ {
|
||||
mt.pause(interval)
|
||||
fl.Touch()
|
||||
fl.Touch("")
|
||||
slept, _ := mt.lastSleep()
|
||||
if slept {
|
||||
t.Fatalf("should not have slept")
|
||||
|
|
@ -77,7 +77,7 @@ func TestFakelag(t *testing.T) {
|
|||
}
|
||||
|
||||
mt.pause(interval)
|
||||
fl.Touch()
|
||||
fl.Touch("")
|
||||
if fl.state != FakelagThrottled {
|
||||
t.Fatalf("should be throttled")
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ func TestFakelag(t *testing.T) {
|
|||
}
|
||||
|
||||
// send another message without a pause; we should have to sleep for 500 msec
|
||||
fl.Touch()
|
||||
fl.Touch("")
|
||||
if fl.state != FakelagThrottled {
|
||||
t.Fatalf("should be throttled")
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ func TestFakelag(t *testing.T) {
|
|||
}
|
||||
|
||||
mt.pause(interval * 6)
|
||||
fl.Touch()
|
||||
fl.Touch("")
|
||||
if fl.state != FakelagThrottled {
|
||||
t.Fatalf("should still be throttled")
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ func TestFakelag(t *testing.T) {
|
|||
}
|
||||
|
||||
mt.pause(window * 2)
|
||||
fl.Touch()
|
||||
fl.Touch("")
|
||||
if fl.state != FakelagBursting {
|
||||
t.Fatalf("should be bursting again")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue