I am using FluentScheduler, and have an issue where I have 2 Registry classes,
FeedRegistry
SitemapRegistry
FeedRegistry is supposed to run every 15min, and sitemapregistry evey 6 hours.
I have this code:
TaskManager.Initialize(new FeedRegistry());
TaskManager.Initialize(new SitemapRegistry());
And
Schedule<FeedTask>().ToRunNow().AndEvery(15).Minutes();
Schedule<SitemapTask>().ToRunNow().AndEvery(6).Hours();
SitemapTask
public class SitemapTask : ITask
{
private readonly ISitemapHelper _sitemapHelper;
public SitemapTask(ISitemapHelper sitemapHelper)
{
_sitemapHelper = sitemapHelper;
}
public void Execute()
{
_sitemapHelper.Process(false);
}
}
FeedTask
public class FeedTask : ITask
{
private readonly IFeedHelper _feedHelper;
public FeedTask(IFeedHelper feedHelper)
{
_feedHelper = feedHelper;
}
public void Execute()
{
_feedHelper.Process(false);
}
}
I am using Autofac and the dependencies have been registered as "InstancePerLifetimeScope". The problem is FeedTask will run only once when the application begins but will not run again after 15minutes. However if I reverse the Initializations like
Schedule<SitemapTask>().ToRunNow().AndEvery(6).Hours();
Schedule<FeedTask>().ToRunNow().AndEvery(15).Minutes();
It will run every 15minutes (and I assume the sitemap will not run every 6 hours)
How to fix?