Skip to content

Instance Property

maximumConnectionLifetime

iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ macOS 13.0+ tvOS 16.0+ watchOS 9.0+
The maximum amount of time a connection is kept open, measured from when it was established. nil means connections are never closed because of their age. Defaults to nil.
var maximumConnectionLifetime: Duration?

Discussion

Once a connection reaches its lifetime, it is closed immediately if it is idle. If it is currently leased, it no longer accepts new leases and is closed once it has been released. In-flight queries are never interrupted. To avoid closing many connections at once, each connection’s lifetime is reduced by a random amount of up to 2.5%.