mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-08 15:33:09 -06:00
Log NATS connection events (#37)
This commit is contained in:
parent
fbffadc0d3
commit
183c42f4e7
|
|
@ -77,7 +77,17 @@ func (s *NATSInstance) Prepare(process *process.ProcessContext, cfg *config.JetS
|
||||||
func setupNATS(process *process.ProcessContext, cfg *config.JetStream, nc *natsclient.Conn) (natsclient.JetStreamContext, *natsclient.Conn) {
|
func setupNATS(process *process.ProcessContext, cfg *config.JetStream, nc *natsclient.Conn) (natsclient.JetStreamContext, *natsclient.Conn) {
|
||||||
if nc == nil {
|
if nc == nil {
|
||||||
var err error
|
var err error
|
||||||
opts := []natsclient.Option{}
|
opts := []natsclient.Option{
|
||||||
|
natsclient.DisconnectErrHandler(func(c *natsclient.Conn, err error) {
|
||||||
|
logrus.WithError(err).Error("nats connection: disconnected")
|
||||||
|
}),
|
||||||
|
natsclient.ReconnectHandler(func(_ *natsclient.Conn) {
|
||||||
|
logrus.Info("nats connection: client reconnected")
|
||||||
|
}),
|
||||||
|
natsclient.ClosedHandler(func(_ *natsclient.Conn) {
|
||||||
|
logrus.Info("nats connection: client closed")
|
||||||
|
}),
|
||||||
|
}
|
||||||
if cfg.DisableTLSValidation {
|
if cfg.DisableTLSValidation {
|
||||||
opts = append(opts, natsclient.Secure(&tls.Config{
|
opts = append(opts, natsclient.Secure(&tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue