diff --git a/src/Hangfire.SqlServer/SqlServerJobQueue.cs b/src/Hangfire.SqlServer/SqlServerJobQueue.cs index 757a9e258..55dd9fa5b 100644 --- a/src/Hangfire.SqlServer/SqlServerJobQueue.cs +++ b/src/Hangfire.SqlServer/SqlServerJobQueue.cs @@ -78,7 +78,7 @@ public void Enqueue(DbConnection connection, DbTransaction transaction, string q var query = _storage.GetQueryFromTemplate(static schemaName => $@"insert into [{schemaName}].JobQueue (JobId, Queue) values (@jobId, @queue)"); - var command = ((DbConnection)connection).Create(query, timeout: _storage.CommandTimeout); + using var command = ((DbConnection)connection).Create(query, timeout: _storage.CommandTimeout); command.AddParameter("@jobId", long.Parse(jobId, CultureInfo.InvariantCulture), DbType.Int64); command.AddParameter("@queue", queue, DbType.String);