check / check (push) Waiting to run
The slowest test packages spent their time waiting rather than testing. db.Params gains an optional PasswordCost (zero means bcrypt.DefaultCost), and the db, ircserver and handlers tests hash at bcrypt.MinCost. A test IRC server's relay checks its queue on broker notification instead of polling. The service and handlers tests build config.Config directly and run in parallel; config exports DefaultTrustedProxies and ParseTrustedProxies for them. Fixed sleeps give way to waits for the event. Production defaults are unchanged. What still takes time is CPU work under -race or a timeout a test is about. Model: opus-5-5
24 lines
511 B
Go
24 lines
511 B
Go
package handlers
|
|
|
|
import (
|
|
"context"
|
|
|
|
"sneak.berlin/go/neoirc/internal/db"
|
|
)
|
|
|
|
// MaxLongPollTimeout is the longest HandleGetMessages waits, in
|
|
// seconds.
|
|
const MaxLongPollTimeout = maxLongPollTimeout
|
|
|
|
// SetPollMessages makes HandleGetMessages read the client
|
|
// output queue with poll in place of Database.PollMessages.
|
|
func (hdlr *Handlers) SetPollMessages(
|
|
poll func(
|
|
ctx context.Context,
|
|
clientID, afterQueueID int64,
|
|
limit int,
|
|
) ([]db.IRCMessage, int64, error),
|
|
) {
|
|
hdlr.pollMessages = poll
|
|
}
|