Start no prefix flush after the stop deadline (closes #188)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
When a write ran past the stop deadline, a full batch's wake-up or a tick could wait beside Stop's context. The flush goroutine's select picked one of them at random, so about half the time it wrote that batch after the deadline. That was the intermittent failure of TestPrefixHandlerSkipsItsLastWriteAfterTheStopDeadline. The flush goroutine now takes a waiting stop first. A new test hands over a full batch while a write is held; it fails about half its runs on the old code. TestPrefixHandlerSkipsItsLastWriteAfterTheStopDeadline and TestPrefixHandlerStopLogsTheTableChangesLeftUnwritten also failed when the flush timer fired between two of their steps. Both now give the handler a timer interval longer than the test. Model: opus-5-5
This commit was merged in pull request #190.
This commit is contained in:
@@ -980,6 +980,11 @@ func TestPrefixHandlerStopLogsNothingAfterADeleteThatSucceeds(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// longerThanAnyTest is a flush timer interval that no test lasts. A test whose
|
||||
// prefix handler must flush only when its batch is full and on Stop gives it to
|
||||
// newPrefixHandler.
|
||||
const longerThanAnyTest = time.Hour
|
||||
|
||||
// prefixHandlerWithoutTimer returns a prefix handler that writes to store and
|
||||
// applies the updates to an empty routing table. It is built without
|
||||
// NewPrefixHandler's flush goroutine, so the test flushes itself.
|
||||
|
||||
Reference in New Issue
Block a user