1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

tested flushing nats.Conn

This commit is contained in:
postmannen 2022-06-21 10:40:32 +02:00
parent 8ec6372565
commit 93a61d8ef3
2 changed files with 10 additions and 1 deletions

View file

@ -272,8 +272,16 @@ func (p process) messageDeliverNats(natsMsgPayload []byte, natsMsgHeader nats.He
}
p.metrics.promNatsDeliveredTotal.Inc()
// The reaming logic is for handling ACK messages, so we return here
//err = natsConn.Flush()
//if err != nil {
// er := fmt.Errorf("error: nats publish flush failed: %v", err)
// log.Printf("%v\n", er)
// return
//}
// The remaining logic is for handling ACK messages, so we return here
// since it was a NACK message, and all or now done.
return
}

View file

@ -107,6 +107,7 @@ func NewServer(configuration *Configuration, version string) (*server, error) {
// Setting MaxReconnects to -1 which equals unlimited.
conn, err = nats.Connect(configuration.BrokerAddress,
opt,
//nats.FlusherTimeout(time.Second*10),
nats.MaxReconnects(-1),
nats.ReconnectJitter(time.Duration(configuration.NatsReconnectJitter)*time.Millisecond, time.Duration(configuration.NatsReconnectJitterTLS)*time.Second),
nats.Timeout(time.Second*time.Duration(configuration.NatsConnOptTimeout)),