diff --git a/src/Hangfire.SqlServer/CountersAggregator.cs b/src/Hangfire.SqlServer/CountersAggregator.cs index a41b413dd..64e57a924 100644 --- a/src/Hangfire.SqlServer/CountersAggregator.cs +++ b/src/Hangfire.SqlServer/CountersAggregator.cs @@ -57,7 +57,8 @@ public void Execute(CancellationToken cancellationToken) { removedCount = connection.Execute( GetAggregationQuery(_storage), - new { now = DateTime.UtcNow, count = NumberOfRecordsInSinglePass }); + new { now = DateTime.UtcNow, count = NumberOfRecordsInSinglePass }, + commandTimeout: 0); }); if (removedCount >= NumberOfRecordsInSinglePass) diff --git a/src/Hangfire.SqlServer/SqlServerConnection.cs b/src/Hangfire.SqlServer/SqlServerConnection.cs index 49e124828..d56316367 100644 --- a/src/Hangfire.SqlServer/SqlServerConnection.cs +++ b/src/Hangfire.SqlServer/SqlServerConnection.cs @@ -94,7 +94,8 @@ output inserted.Id arguments = invocationData.Arguments, createdAt = createdAt, expireAt = createdAt.Add(expireIn) - }).ToString(); + }, + commandTimeout: _storage.CommandTimeout).ToString(); if (parameters.Count > 0) { @@ -114,7 +115,7 @@ output inserted.Id $@"insert into [{_storage.SchemaName}].JobParameter (JobId, Name, Value) values (@jobId, @name, @value)"; - connection.Execute(insertParameterSql, parameterArray); + connection.Execute(insertParameterSql, parameterArray, commandTimeout: _storage.CommandTimeout); } return jobId; @@ -130,7 +131,7 @@ public override JobData GetJobData(string id) return _storage.UseConnection(connection => { - var jobData = connection.Query(sql, new { id = long.Parse(id) }) + var jobData = connection.Query(sql, new { id = long.Parse(id) }, commandTimeout: _storage.CommandTimeout) .SingleOrDefault(); if (jobData == null) return null; @@ -173,7 +174,7 @@ public override StateData GetStateData(string jobId) return _storage.UseConnection(connection => { - var sqlState = connection.Query(sql, new { jobId = long.Parse(jobId) }).SingleOrDefault(); + var sqlState = connection.Query(sql, new { jobId = long.Parse(jobId) }, commandTimeout: _storage.CommandTimeout).SingleOrDefault(); if (sqlState == null) { return null; @@ -205,7 +206,8 @@ public override void SetJobParameter(string id, string name, string value) on Target.JobId = Source.JobId AND Target.Name = Source.Name when matched then update set Value = Source.Value when not matched then insert (JobId, Name, Value) values (Source.JobId, Source.Name, Source.Value);", - new { jobId = long.Parse(id), name, value }); + new { jobId = long.Parse(id), name, value }, + commandTimeout: _storage.CommandTimeout); }); } @@ -216,7 +218,8 @@ public override string GetJobParameter(string id, string name) return _storage.UseConnection(connection => connection.ExecuteScalar( $@"select top (1) Value from [{_storage.SchemaName}].JobParameter with (readcommittedlock) where JobId = @id and Name = @name", - new { id = long.Parse(id), name = name })); + new { id = long.Parse(id), name = name }, + commandTimeout: _storage.CommandTimeout)); } public override HashSet GetAllItemsFromSet(string key) @@ -227,7 +230,8 @@ public override HashSet GetAllItemsFromSet(string key) { var result = connection.Query( $@"select Value from [{_storage.SchemaName}].[Set] with (readcommittedlock) where [Key] = @key", - new { key }); + new { key }, + commandTimeout: _storage.CommandTimeout); return new HashSet(result); }); @@ -240,7 +244,8 @@ public override string GetFirstByLowestScoreFromSet(string key, double fromScore return _storage.UseConnection(connection => connection.ExecuteScalar( $@"select top 1 Value from [{_storage.SchemaName}].[Set] with (readcommittedlock) where [Key] = @key and Score between @from and @to order by Score", - new { key, from = fromScore, to = toScore })); + new { key, from = fromScore, to = toScore }, + commandTimeout: _storage.CommandTimeout)); } public override void SetRangeInHash(string key, IEnumerable> keyValuePairs) @@ -259,7 +264,11 @@ public override void SetRangeInHash(string key, IEnumerable GetAllEntriesFromHash(string key) { var result = connection.Query( $"select Field, Value from [{_storage.SchemaName}].Hash with (forceseek, readcommittedlock) where [Key] = @key", - new { key }) + new { key }, + commandTimeout: _storage.CommandTimeout) .ToDictionary(x => x.Field, x => x.Value); return result.Count != 0 ? result : null; @@ -299,7 +309,8 @@ public override void AnnounceServer(string serverId, ServerContext context) on Target.Id = Source.Id when matched then update set Data = Source.Data, LastHeartbeat = Source.Heartbeat when not matched then insert (Id, Data, LastHeartbeat) values (Source.Id, Source.Data, Source.Heartbeat);", - new { id = serverId, data = JobHelper.ToJson(data), heartbeat = DateTime.UtcNow }); + new { id = serverId, data = JobHelper.ToJson(data), heartbeat = DateTime.UtcNow }, + commandTimeout: _storage.CommandTimeout); }); } @@ -311,7 +322,8 @@ public override void RemoveServer(string serverId) { connection.Execute( $@"delete from [{_storage.SchemaName}].Server where Id = @id", - new { id = serverId }); + new { id = serverId }, + commandTimeout: _storage.CommandTimeout); }); } @@ -323,7 +335,8 @@ public override void Heartbeat(string serverId) { connection.Execute( $@"update [{_storage.SchemaName}].Server set LastHeartbeat = @now where Id = @id", - new { now = DateTime.UtcNow, id = serverId }); + new { now = DateTime.UtcNow, id = serverId }, + commandTimeout: _storage.CommandTimeout); }); } @@ -336,7 +349,8 @@ public override int RemoveTimedOutServers(TimeSpan timeOut) return _storage.UseConnection(connection => connection.Execute( $@"delete from [{_storage.SchemaName}].Server where LastHeartbeat < @timeOutAt", - new { timeOutAt = DateTime.UtcNow.Add(timeOut.Negate()) })); + new { timeOutAt = DateTime.UtcNow.Add(timeOut.Negate()) }, + commandTimeout: _storage.CommandTimeout)); } public override long GetSetCount(string key) @@ -345,7 +359,8 @@ public override long GetSetCount(string key) return _storage.UseConnection(connection => connection.Query( $"select count([Key]) from [{_storage.SchemaName}].[Set] with (readcommittedlock) where [Key] = @key", - new { key = key }).First()); + new { key = key }, + commandTimeout: _storage.CommandTimeout).First()); } public override List GetRangeFromSet(string key, int startingFrom, int endingAt) @@ -360,7 +375,7 @@ public override List GetRangeFromSet(string key, int startingFrom, int e ) as s where s.row_num between @startingFrom and @endingAt"; return _storage.UseConnection(connection => connection - .Query(query, new { key = key, startingFrom = startingFrom + 1, endingAt = endingAt + 1 }) + .Query(query, new { key = key, startingFrom = startingFrom + 1, endingAt = endingAt + 1 }, commandTimeout: _storage.CommandTimeout) .ToList()); } @@ -372,7 +387,7 @@ public override TimeSpan GetSetTtl(string key) return _storage.UseConnection(connection => { - var result = connection.ExecuteScalar(query, new { key = key }); + var result = connection.ExecuteScalar(query, new { key = key }, commandTimeout: _storage.CommandTimeout); if (!result.HasValue) return TimeSpan.FromSeconds(-1); return result.Value - DateTime.UtcNow; @@ -391,7 +406,7 @@ union all where [Key] = @key) as s"; return _storage.UseConnection(connection => - connection.ExecuteScalar(query, new { key = key }) ?? 0); + connection.ExecuteScalar(query, new { key = key }, commandTimeout: _storage.CommandTimeout) ?? 0); } public override long GetHashCount(string key) @@ -400,7 +415,7 @@ public override long GetHashCount(string key) string query = $@"select count([Id]) from [{_storage.SchemaName}].Hash with (readcommittedlock) where [Key] = @key"; - return _storage.UseConnection(connection => connection.ExecuteScalar(query, new { key = key })); + return _storage.UseConnection(connection => connection.ExecuteScalar(query, new { key = key }, commandTimeout: _storage.CommandTimeout)); } public override TimeSpan GetHashTtl(string key) @@ -411,7 +426,7 @@ public override TimeSpan GetHashTtl(string key) return _storage.UseConnection(connection => { - var result = connection.ExecuteScalar(query, new { key = key }); + var result = connection.ExecuteScalar(query, new { key = key }, commandTimeout: _storage.CommandTimeout); if (!result.HasValue) return TimeSpan.FromSeconds(-1); return result.Value - DateTime.UtcNow; @@ -428,7 +443,7 @@ public override string GetValueFromHash(string key, string name) where [Key] = @key and [Field] = @field"; return _storage.UseConnection(connection => connection - .ExecuteScalar(query, new { key = key, field = name })); + .ExecuteScalar(query, new { key = key, field = name }, commandTimeout: _storage.CommandTimeout)); } public override long GetListCount(string key) @@ -439,7 +454,7 @@ public override long GetListCount(string key) $@"select count([Id]) from [{_storage.SchemaName}].List with (readcommittedlock) where [Key] = @key"; - return _storage.UseConnection(connection => connection.ExecuteScalar(query, new { key = key })); + return _storage.UseConnection(connection => connection.ExecuteScalar(query, new { key = key }, commandTimeout: _storage.CommandTimeout)); } public override TimeSpan GetListTtl(string key) @@ -452,7 +467,7 @@ public override TimeSpan GetListTtl(string key) return _storage.UseConnection(connection => { - var result = connection.ExecuteScalar(query, new { key = key }); + var result = connection.ExecuteScalar(query, new { key = key }, commandTimeout: _storage.CommandTimeout); if (!result.HasValue) return TimeSpan.FromSeconds(-1); return result.Value - DateTime.UtcNow; @@ -471,7 +486,7 @@ public override List GetRangeFromList(string key, int startingFrom, int ) as s where s.row_num between @startingFrom and @endingAt"; return _storage.UseConnection(connection => connection - .Query(query, new { key = key, startingFrom = startingFrom + 1, endingAt = endingAt + 1 }) + .Query(query, new { key = key, startingFrom = startingFrom + 1, endingAt = endingAt + 1 }, commandTimeout: _storage.CommandTimeout) .ToList()); } @@ -484,7 +499,7 @@ public override List GetAllItemsFromList(string key) where [Key] = @key order by [Id] desc"; - return _storage.UseConnection(connection => connection.Query(query, new { key = key }).ToList()); + return _storage.UseConnection(connection => connection.Query(query, new { key = key }, commandTimeout: _storage.CommandTimeout).ToList()); } } } diff --git a/src/Hangfire.SqlServer/SqlServerJobQueue.cs b/src/Hangfire.SqlServer/SqlServerJobQueue.cs index 83b2d30f2..38ed9558a 100644 --- a/src/Hangfire.SqlServer/SqlServerJobQueue.cs +++ b/src/Hangfire.SqlServer/SqlServerJobQueue.cs @@ -74,7 +74,8 @@ public IFetchedJob Dequeue(string[] queues, CancellationToken cancellationToken) fetchedJob = connection.Query( fetchJobSqlTemplate, new { queues = queues }, - transaction).SingleOrDefault(); + transaction, + commandTimeout: _storage.CommandTimeout).SingleOrDefault(); if (fetchedJob != null) { @@ -117,7 +118,7 @@ public void Enqueue(DbConnection connection, DbTransaction transaction, string q #if !NETFULL , transaction #endif - ); + , commandTimeout: _storage.CommandTimeout); } [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] diff --git a/src/Hangfire.SqlServer/SqlServerJobQueueMonitoringApi.cs b/src/Hangfire.SqlServer/SqlServerJobQueueMonitoringApi.cs index 9a24bb6ba..37578b070 100644 --- a/src/Hangfire.SqlServer/SqlServerJobQueueMonitoringApi.cs +++ b/src/Hangfire.SqlServer/SqlServerJobQueueMonitoringApi.cs @@ -56,7 +56,7 @@ public IEnumerable GetQueues() { var result = UseTransaction((connection, transaction) => { - return connection.Query(sqlQuery, transaction: transaction).Select(x => (string) x.Queue).ToList(); + return connection.Query(sqlQuery, transaction: transaction, commandTimeout: _storage.CommandTimeout).Select(x => (string) x.Queue).ToList(); }); _queuesCache = result; @@ -83,7 +83,8 @@ public IEnumerable GetEnqueuedJobIds(string queue, int @from, int perPage) return connection.Query( sqlQuery, new { queue = queue, start = from + 1, end = @from + perPage }, - transaction) + transaction, + commandTimeout: _storage.CommandTimeout) .ToList() .Select(x => (int)x.JobId) .ToList(); @@ -102,7 +103,7 @@ public EnqueuedAndFetchedCountDto GetEnqueuedAndFetchedCount(string queue) return UseTransaction((connection, transaction) => { - var result = connection.ExecuteScalar(sqlQuery, new { queue = queue }, transaction); + var result = connection.ExecuteScalar(sqlQuery, new { queue = queue }, transaction, commandTimeout: _storage.CommandTimeout); return new EnqueuedAndFetchedCountDto { diff --git a/src/Hangfire.SqlServer/SqlServerMonitoringApi.cs b/src/Hangfire.SqlServer/SqlServerMonitoringApi.cs index 46d1dcf8a..92ab530b0 100644 --- a/src/Hangfire.SqlServer/SqlServerMonitoringApi.cs +++ b/src/Hangfire.SqlServer/SqlServerMonitoringApi.cs @@ -122,7 +122,7 @@ public IList Servers() return UseConnection>(connection => { var servers = connection.Query( - $@"select * from [{_storage.SchemaName}].Server with (nolock)") + $@"select * from [{_storage.SchemaName}].Server with (nolock)", commandTimeout: _storage.CommandTimeout) .ToList(); var result = new List(); @@ -266,7 +266,7 @@ public JobDetailsDto JobDetails(string jobId) select * from [{_storage.SchemaName}].JobParameter with (nolock) where JobId = @id select * from [{_storage.SchemaName}].State with (nolock) where JobId = @id order by Id desc"; - using (var multi = connection.QueryMultiple(sql, new { id = jobId })) + using (var multi = connection.QueryMultiple(sql, new { id = jobId }, commandTimeout: _storage.CommandTimeout)) { var job = multi.Read().SingleOrDefault(); if (job == null) return null; @@ -336,7 +336,7 @@ union all var statistics = UseConnection(connection => { var stats = new StatisticsDto(); - using (var multi = connection.QueryMultiple(sql)) + using (var multi = connection.QueryMultiple(sql, commandTimeout: _storage.CommandTimeout)) { stats.Enqueued = multi.ReadSingle(); stats.Failed = multi.ReadSingle(); @@ -400,7 +400,8 @@ private Dictionary GetTimelineStats( var valuesMap = connection.Query( sqlQuery, - new { keys = keyMaps.Keys }) + new { keys = keyMaps.Keys }, + commandTimeout: _storage.CommandTimeout) .ToDictionary(x => (string)x.Key, x => (long)x.Count); foreach (var key in keyMaps.Keys) @@ -441,7 +442,8 @@ private JobList EnqueuedJobs(DbConnection connection, long[] job var jobs = connection.Query( enqueuedJobsSql, - new { jobIds = jobIds }) + new { jobIds = jobIds }, + commandTimeout: _storage.CommandTimeout) .ToDictionary(x => x.Id, x => x); var sortedSqlJobs = jobIds @@ -468,7 +470,8 @@ private long GetNumberOfJobsByStateName(DbConnection connection, string stateNam var count = connection.ExecuteScalar( sqlQuery, - new { state = stateName, limit = _jobListLimit }); + new { state = stateName, limit = _jobListLimit }, + commandTimeout: _storage.CommandTimeout); return count; } @@ -511,7 +514,8 @@ where cte.row_num between @start and @end var jobs = connection.Query( jobsSql, - new { stateName = stateName, start = @from + 1, end = @from + count }) + new { stateName = stateName, start = @from + 1, end = @from + count }, + commandTimeout: _storage.CommandTimeout) .ToList(); return DeserializeJobs(jobs, selector); @@ -555,7 +559,8 @@ private JobList FetchedJobs(DbConnection connection, IEnumerable< var jobs = connection.Query( fetchedJobsSql, - new { jobIds = jobIds }) + new { jobIds = jobIds }, + commandTimeout: _storage.CommandTimeout) .ToList(); var result = new List>(jobs.Count); diff --git a/src/Hangfire.SqlServer/SqlServerObjectsInstaller.cs b/src/Hangfire.SqlServer/SqlServerObjectsInstaller.cs index 9781ae8df..b29792b6f 100644 --- a/src/Hangfire.SqlServer/SqlServerObjectsInstaller.cs +++ b/src/Hangfire.SqlServer/SqlServerObjectsInstaller.cs @@ -60,7 +60,7 @@ public static void Install(DbConnection connection, string schema) { try { - connection.Execute(script); + connection.Execute(script, commandTimeout: 0); break; } catch (DbException ex) @@ -76,7 +76,7 @@ public static void Install(DbConnection connection, string schema) } } #else - connection.Execute(script); + connection.Execute(script, commandTimeout: 0); #endif Log.Info("Hangfire SQL objects installed."); diff --git a/src/Hangfire.SqlServer/SqlServerStorage.cs b/src/Hangfire.SqlServer/SqlServerStorage.cs index ee23e2ed3..6096e2bfd 100644 --- a/src/Hangfire.SqlServer/SqlServerStorage.cs +++ b/src/Hangfire.SqlServer/SqlServerStorage.cs @@ -96,6 +96,7 @@ public SqlServerStorage([NotNull] DbConnection existingConnection) public virtual PersistentJobQueueProviderCollection QueueProviders { get; private set; } internal string SchemaName => _options.SchemaName; + internal int? CommandTimeout => _options.CommandTimeout.HasValue ? (int)_options.CommandTimeout.Value.TotalSeconds : (int?)null; public override IMonitoringApi GetMonitoringApi() { diff --git a/src/Hangfire.SqlServer/SqlServerStorageOptions.cs b/src/Hangfire.SqlServer/SqlServerStorageOptions.cs index 5cb293ddb..5ddfbd198 100644 --- a/src/Hangfire.SqlServer/SqlServerStorageOptions.cs +++ b/src/Hangfire.SqlServer/SqlServerStorageOptions.cs @@ -75,6 +75,7 @@ public TimeSpan QueuePollInterval public int? DashboardJobListLimit { get; set; } public TimeSpan TransactionTimeout { get; set; } + public TimeSpan? CommandTimeout { get; set; } public string SchemaName { diff --git a/src/Hangfire.SqlServer/SqlServerWriteOnlyTransaction.cs b/src/Hangfire.SqlServer/SqlServerWriteOnlyTransaction.cs index 8572cecd4..3025d692c 100644 --- a/src/Hangfire.SqlServer/SqlServerWriteOnlyTransaction.cs +++ b/src/Hangfire.SqlServer/SqlServerWriteOnlyTransaction.cs @@ -57,7 +57,8 @@ public override void Commit() "set nocount on;" + "exec sp_getapplock @Resource=@resource, @LockMode=N'Exclusive'", _lockedResources.Select(x => new { resource = x }), - transaction); + transaction, + _storage.CommandTimeout); } foreach (var command in _commandQueue) @@ -77,7 +78,8 @@ public override void ExpireJob(string jobId, TimeSpan expireIn) QueueCommand((connection, transaction) => connection.Execute( $@"update [{_storage.SchemaName}].Job set ExpireAt = @expireAt where Id = @id", new { expireAt = DateTime.UtcNow.Add(expireIn), id = long.Parse(jobId) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void PersistJob(string jobId) @@ -85,7 +87,8 @@ public override void PersistJob(string jobId) QueueCommand((connection, transaction) => connection.Execute( $@"update [{_storage.SchemaName}].Job set ExpireAt = NULL where Id = @id", new { id = long.Parse(jobId) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void SetJobState(string jobId, IState state) @@ -106,7 +109,8 @@ public override void SetJobState(string jobId, IState state) data = JobHelper.ToJson(state.SerializeData()), id = long.Parse(jobId) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void AddJobState(string jobId, IState state) @@ -125,7 +129,8 @@ public override void AddJobState(string jobId, IState state) createdAt = DateTime.UtcNow, data = JobHelper.ToJson(state.SerializeData()) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void AddToQueue(string queue, string jobId) @@ -152,7 +157,8 @@ public override void IncrementCounter(string key) QueueCommand((connection, transaction) => connection.Execute( $@"insert into [{_storage.SchemaName}].Counter ([Key], [Value]) values (@key, @value)", new { key, value = +1 }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void IncrementCounter(string key, TimeSpan expireIn) @@ -160,7 +166,8 @@ public override void IncrementCounter(string key, TimeSpan expireIn) QueueCommand((connection, transaction) => connection.Execute( $@"insert into [{_storage.SchemaName}].Counter ([Key], [Value], [ExpireAt]) values (@key, @value, @expireAt)", new { key, value = +1, expireAt = DateTime.UtcNow.Add(expireIn) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void DecrementCounter(string key) @@ -168,7 +175,8 @@ public override void DecrementCounter(string key) QueueCommand((connection, transaction) => connection.Execute( $@"insert into [{_storage.SchemaName}].Counter ([Key], [Value]) values (@key, @value)", new { key, value = -1 }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void DecrementCounter(string key, TimeSpan expireIn) @@ -176,7 +184,8 @@ public override void DecrementCounter(string key, TimeSpan expireIn) QueueCommand((connection, transaction) => connection.Execute( $@"insert into [{_storage.SchemaName}].Counter ([Key], [Value], [ExpireAt]) values (@key, @value, @expireAt)", new { key, value = -1, expireAt = DateTime.UtcNow.Add(expireIn) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void AddToSet(string key, string value) @@ -197,7 +206,8 @@ public override void AddToSet(string key, string value, double score) QueueCommand((connection, transaction) => connection.Execute( addSql, new { key, value, score }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void RemoveFromSet(string key, string value) @@ -208,7 +218,8 @@ public override void RemoveFromSet(string key, string value) QueueCommand((connection, transaction) => connection.Execute( query, new { key, value }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void InsertToList(string key, string value) @@ -217,7 +228,8 @@ public override void InsertToList(string key, string value) QueueCommand((connection, transaction) => connection.Execute( $@"insert into [{_storage.SchemaName}].List ([Key], Value) values (@key, @value);", new { key, value }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void RemoveFromList(string key, string value) @@ -226,7 +238,8 @@ public override void RemoveFromList(string key, string value) QueueCommand((connection, transaction) => connection.Execute( $@"delete from [{_storage.SchemaName}].List where [Key] = @key and Value = @value", new { key, value }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void TrimList(string key, int keepStartingFrom, int keepEndingAt) @@ -242,7 +255,8 @@ from [{_storage.SchemaName}].List QueueCommand((connection, transaction) => connection.Execute( trimSql, new { key = key, start = keepStartingFrom + 1, end = keepEndingAt + 1 }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void SetRangeInHash(string key, IEnumerable> keyValuePairs) @@ -261,7 +275,8 @@ public override void SetRangeInHash(string key, IEnumerable connection.Execute( sql, keyValuePairs.Select(y => new { key = key, field = y.Key, value = y.Value }), - transaction)); + transaction, + _storage.CommandTimeout)); } public override void RemoveHash(string key) @@ -274,7 +289,8 @@ public override void RemoveHash(string key) QueueCommand((connection, transaction) => connection.Execute( query, new { key }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void AddRangeToSet(string key, IList items) @@ -291,7 +307,8 @@ public override void AddRangeToSet(string key, IList items) QueueCommand((connection, transaction) => connection.Execute( query, items.Select(value => new { key = key, value = value }).ToList(), - transaction)); + transaction, + _storage.CommandTimeout)); } public override void RemoveSet(string key) @@ -304,7 +321,8 @@ public override void RemoveSet(string key) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void ExpireHash(string key, TimeSpan expireIn) @@ -318,7 +336,8 @@ public override void ExpireHash(string key, TimeSpan expireIn) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key, expireAt = DateTime.UtcNow.Add(expireIn) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void ExpireSet(string key, TimeSpan expireIn) @@ -332,7 +351,8 @@ public override void ExpireSet(string key, TimeSpan expireIn) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key, expireAt = DateTime.UtcNow.Add(expireIn) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void ExpireList(string key, TimeSpan expireIn) @@ -346,7 +366,8 @@ public override void ExpireList(string key, TimeSpan expireIn) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key, expireAt = DateTime.UtcNow.Add(expireIn) }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void PersistHash(string key) @@ -360,7 +381,8 @@ public override void PersistHash(string key) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void PersistSet(string key) @@ -374,7 +396,8 @@ public override void PersistSet(string key) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key }, - transaction)); + transaction, + _storage.CommandTimeout)); } public override void PersistList(string key) @@ -388,7 +411,8 @@ public override void PersistList(string key) QueueCommand((connection, transaction) => connection.Execute( query, new { key = key }, - transaction)); + transaction, + _storage.CommandTimeout)); } internal void QueueCommand(Action action)