Add configuration for queue processing interval

This commit is contained in:
2016-04-13 10:48:06 -04:00
parent b317f0c65a
commit 123af4f44d
2 changed files with 6 additions and 4 deletions
+5 -4
View File
@@ -3,7 +3,9 @@ using Hangfire;
using Microsoft.Owin;
using LeafWeb.Web;
using LeafWeb.Web.Services;
using NLog.Internal;
using Owin;
using ConfigurationManager = System.Configuration.ConfigurationManager;
[assembly: OwinStartup(typeof(HangfireStartup))]
@@ -15,9 +17,6 @@ namespace LeafWeb.Web
public void Configuration(IAppBuilder app)
{
//GlobalConfiguration.Configuration
// .UseSqlServerStorage("LeafWebContext");
app.UseHangfireDashboard();
app.UseHangfireServer();
@@ -27,8 +26,9 @@ namespace LeafWeb.Web
private void SetupRecurringJobs()
{
// TODO: new SqlServerDistributedLock
var queueInterval = ConfigurationManager.AppSettings["ProcessQueueInterval"];
// 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 * * * *");
RecurringJob.AddOrUpdate<PiscalQueueManager>(PiscalProcessQueue, p => p.ProcessQueue(), queueInterval);
}
public static void TriggerPiscalProcessQueue()
@@ -81,6 +81,7 @@ namespace LeafWeb.Web
{
lock (_lockObject)
{
_backgroundJobServer?.Dispose();
HostingEnvironment.UnregisterObject(this);
+1
View File
@@ -24,6 +24,7 @@
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="TimeZoneId" value="US Eastern Standard Time" />
<add key="EmailFromAddress" value="LeafWeb &lt;noreply@leafweb.org&gt;" />
<add key="ProcessQueueInterval" value="*/1 * * * *"/>
<add key="SmtpHost" value="localhost"/>
<add key="SmtpPort" value="25"/>
<add key="SmtpUserName" value=""/>