Add items to prevent azure from overloading db
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
using System.Data.Entity.ModelConfiguration.Conventions;
|
using System.Data.Entity.ModelConfiguration.Conventions;
|
||||||
|
using System.Data.Entity.SqlServer;
|
||||||
using LeafWeb.Core.Entities;
|
using LeafWeb.Core.Entities;
|
||||||
|
|
||||||
namespace LeafWeb.Core.DAL
|
namespace LeafWeb.Core.DAL
|
||||||
@@ -19,4 +20,12 @@ namespace LeafWeb.Core.DAL
|
|||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LeafWebDbConfiguration : DbConfiguration
|
||||||
|
{
|
||||||
|
public LeafWebDbConfiguration()
|
||||||
|
{
|
||||||
|
SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ namespace LeafWeb.Web
|
|||||||
private void SetupRecurringJobs()
|
private void SetupRecurringJobs()
|
||||||
{
|
{
|
||||||
// TODO: new SqlServerDistributedLock
|
// TODO: new SqlServerDistributedLock
|
||||||
RecurringJob.AddOrUpdate<PiscalQueueManager>(PiscalProcessQueue, p => p.ProcessQueue(), Cron.Minutely());
|
// https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533
|
||||||
|
RecurringJob.AddOrUpdate<PiscalQueueManager>(PiscalProcessQueue, p => p.ProcessQueue(), "*/15 * * * *");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TriggerPiscalProcessQueue()
|
public static void TriggerPiscalProcessQueue()
|
||||||
|
|||||||
Reference in New Issue
Block a user