public void TestDefaults()
        {
            var defaultOptions = RedisDistributedSynchronizationOptionsBuilder.GetOptions(null);

            defaultOptions.RedLockTimeouts.Expiry.ShouldEqual(RedisDistributedSynchronizationOptionsBuilder.DefaultExpiry);
            defaultOptions.RedLockTimeouts.MinValidityTime.ShouldEqual(TimeSpan.FromSeconds(27));
            defaultOptions.ExtensionCadence.ShouldEqual(TimeSpan.FromSeconds(9));
            defaultOptions.MinBusyWaitSleepTime.ShouldEqual(TimeSpan.FromMilliseconds(10));
            defaultOptions.MaxBusyWaitSleepTime.ShouldEqual(TimeSpan.FromMilliseconds(800));
        }
        public void Options(RedisDistributedSynchronizationOptionsBuilder options)
        {
            if (this._preparedForHandleLost)
            {
                options.ExtensionCadence(TimeSpan.FromMilliseconds(30));
            }
            if (this._preparedForHandleAbandonment)
            {
                options.Expiry(TimeSpan.FromSeconds(.2))
                // the reader writer lock requires that the busy wait sleep time is shorter
                // than the expiry, so adjust for that
                .BusyWaitSleepTime(TimeSpan.FromSeconds(.01), TimeSpan.FromSeconds(.1));
            }

            this._options?.Invoke(options);
        }
 private static void GetOptions(Action <RedisDistributedSynchronizationOptionsBuilder> options) =>
 RedisDistributedSynchronizationOptionsBuilder.GetOptions(options);
Beispiel #4
0
 private static void RedisOptions(RedisDistributedSynchronizationOptionsBuilder options) =>
 options.Expiry(TimeSpan.FromSeconds(.5))     // short expiry for abandonment testing
 .BusyWaitSleepTime(TimeSpan.FromSeconds(.1), TimeSpan.FromSeconds(.3));