Skip to content

Commit

Permalink
Add SyncTimeout configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
samcook committed Jul 16, 2017
1 parent e5d3547 commit ca86de8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion RedLock/RedisLockEndPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ public EndPoint EndPoint {
/// Defaults to 100ms if not specified.
/// </summary>
public int? ConnectionTimeout { get; set; }


/// <summary>
/// The sync timeout for the redis connection.
/// Defaults to 1000ms if not specified.
/// </summary>
public int? SyncTimeout { get; set; }

/// <summary>
/// The database to use with this redis connection.
/// Defaults to 0 if not specified.
Expand Down
2 changes: 2 additions & 0 deletions RedLock/RedisLockFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class RedisLockFactory : IRedisLockFactory, IDisposable
private static readonly ILog Logger = LogProvider.GetCurrentClassLogger();

private const int DefaultConnectionTimeout = 100;
private const int DefaultSyncTimeout = 1000;
private const int DefaultRedisDatabase = 0;
private const int DefaultConfigCheckSeconds = 10;
private readonly IList<RedisConnection> redisCaches;
Expand Down Expand Up @@ -59,6 +60,7 @@ private static IList<RedisConnection> CreateRedisCaches(ICollection<RedisLockEnd
{
AbortOnConnectFail = false,
ConnectTimeout = endPoint.ConnectionTimeout ?? DefaultConnectionTimeout,
SyncTimeout = endPoint.SyncTimeout ?? DefaultSyncTimeout,
Ssl = endPoint.Ssl,
Password = endPoint.Password,
ConfigCheckSeconds = endPoint.ConfigCheckSeconds ?? DefaultConfigCheckSeconds
Expand Down

0 comments on commit ca86de8

Please sign in to comment.