check / check (push) Failing after 3s
- Tests hash passwords at bcrypt.MinCost, set through the PasswordCost field of db.Params. TestPasswordCost checks the cost with and without it. - Test IRC servers check the queue only on broker notification; one test keeps the 100 ms fallback poll. - The stop-timeout test shortens the timeout through a test-only setter. - service and handlers tests build config.Config directly instead of through config.New, so they run in parallel. config exports DefaultTrustedProxies and ParseTrustedProxies for the handlers test config. - Repeated race trials run as parallel subtests. - Fixed sleeps become waits on the broker. - A new test covers the relay's failed queue read, which only the 100 ms poll had reached. 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
|
|
}
|