Пример #1
0
        /// <summary>
        /// The amount of time a Topic should stay in memory after its last subscriber is removed.
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static TimeSpan TopicTtl(this TransportOptions options)
        {
            // If the deep-alive is disabled, don't take it into account when calculating the topic TTL.
            var keepAliveTimeout = options.KeepAliveTimeout() ?? TimeSpan.Zero;

            // Keep topics alive for twice as long as we let connections to reconnect. (The DisconnectTimeout)
            // Also add twice the keep-alive timeout since clients might take a while to notice they are disconnected.
            // This should be a very conservative estimate for how long we must wait before considering a topic dead.
            return(TimeSpan.FromTicks((options.DisconnectTimeout.Ticks + keepAliveTimeout.Ticks) * 2));
        }