mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
@ -138,5 +138,7 @@ func getFreePort() (port int, err error) {
|
||||
}
|
||||
|
||||
defer listener.Close()
|
||||
// This is always a *net.TCPAddr.
|
||||
// nolint:forcetypeassert
|
||||
return listener.Addr().(*net.TCPAddr).Port, nil
|
||||
}
|
||||
|
@ -72,6 +72,9 @@ func (p *pgPubsub) Subscribe(event string, listener Listener) (cancel func(), er
|
||||
}
|
||||
|
||||
func (p *pgPubsub) Publish(event string, message []byte) error {
|
||||
// This is safe because we are calling pq.QuoteLiteral. pg_notify doesn't
|
||||
// support the first parameter being a prepared statement.
|
||||
//nolint:gosec
|
||||
_, err := p.db.ExecContext(context.Background(), `select pg_notify(`+pq.QuoteLiteral(event)+`, $1)`, message)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("exec: %w", err)
|
||||
|
Reference in New Issue
Block a user