How can we continue processing Enqueued jobs after a restart of the Server. Does this happen automatically?
We have a application hosted in Azure, had a few hundred intensive tasks running, and did a redeploy - we then noticed that once the application was redeployed, the enqueued jobs were not processing.
Is this due to not using the Graceful Shutdown ?
We are using MSSQL for Job Storage, are there flags we can set to remove and locks on the jobs ?
Love hangfire by the way.
Thank you.
Edit *
Would something like this suffice ? Or is there another way ?
List ids = new List();
using (var connection = new SqlConnection(databaseConnectionString)) { SqlCommand command = new SqlCommand("Select StateId from [HangFire].[Job] WHERE StateName = 'Enqueued'", connection);
connection.Open(); var reader = command.ExecuteReader();
while (reader.Read()) { ids.Add(reader["StateId"].ToString()); }
reader.Close(); }
var client = new BackgroundJobClient(); foreach (var id in ids) { client.Requeue(id); }