Start no AS, peer or peering write after the stop deadline (closes #189)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A write can run past the stop deadline while a full batch's wake-up or a tick waits beside Stop's context. The select picked one at random, so about half the time the AS, peer or peering handler started another write after the deadline. Each loop now takes a waiting stop first, as the prefix handler's does. The prefix, AS and peer handlers' flush loops were near-copies, so they are now one function, flushLoop. A new test for each handler fails about half its runs on the old code. The AS and peer handler tests give the flush timer an interval longer than the test. A timer flush during the fill can no longer hang TestPeerHandlerWaitsAtTheMaximumBatchSize. Model: opus-5-5
This commit was merged in pull request #191.
This commit is contained in:
@@ -981,8 +981,8 @@ 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.
|
||||
// prefix, AS or peer handler must flush only when its batch is full and on Stop
|
||||
// gives it to newPrefixHandler, newASHandler or newPeerHandler.
|
||||
const longerThanAnyTest = time.Hour
|
||||
|
||||
// prefixHandlerWithoutTimer returns a prefix handler that writes to store and
|
||||
|
||||
Reference in New Issue
Block a user