MCPcopy
hub / github.com/nats-io/nats.go / MaxReconnects

Function MaxReconnects

nats.go:1153–1158  ·  view source on GitHub ↗

MaxReconnects is an Option to set the maximum number of reconnect attempts. If negative, it will never stop trying to reconnect. Defaults to 60.

(max int)

Source from the content-addressed store, hash-verified

1151// If negative, it will never stop trying to reconnect.
1152// Defaults to 60.
1153func MaxReconnects(max int) Option {
1154 return func(o *Options) error {
1155 o.MaxReconnect = max
1156 return nil
1157 }
1158}
1159
1160// ReconnectJitter is an Option to set the upper bound of a random delay added ReconnectWait.
1161// Defaults to 100ms and 1s, respectively.

Callers 1

Calls

no outgoing calls

Tested by 1