我已經爲此開發了我自己的解決方案。
首先,將您的任務修改爲每隔1分鐘左右運行一次。它必須頻繁運行。 而不是強制任務運行一次的,你讓你的任務執行它在你喜歡的時間功能,然後等待,直到第二天再次執行功能之前:
在這個例子中,我強迫我的任務運行一次
public void Execute(Item[] itemArray, CommandItem commandItem, ScheduleItem scheduleItem)
{
if (!IsDue(scheduleItem))
return;
// DO MY STUFF!!
}
/// <summary>
/// Determines whether the specified schedule item is due to run.
/// </summary>
/// <remarks>
/// The scheduled item will only run between defined hours (usually at night) to ensure that the
/// email sending will not interfere with daily operations, and to ensure that the task is only run
/// once a day.
/// Make sure you configure the task to run at least double so often than the time span between
/// SendNotifyMailsAfter and SendNotifyMailsBefore
/// </remarks>
/// <param name="scheduleItem">The schedule item.</param>
/// <returns>
/// <c>true</c> if the specified schedule item is due; otherwise, <c>false</c>.
/// </returns>
private bool IsDue(ScheduleItem scheduleItem)
{
DateTime timeBegin;
DateTime timeEnd;
DateTime.TryParse("03:00:00", out timeBegin);
DateTime.TryParse("04:00:00", out timeEnd);
return (CheckTime(DateTime.Now, timeBegin, timeEnd) && !CheckTime(scheduleItem.LastRun, timeBegin, timeEnd));
}
private bool CheckTime(DateTime time, DateTime after, DateTime before)
{
return ((time >= after) && (time <= before));
}
檢查文章的詳細信息::上午03時00和凌晨04:00之間 我的計劃任務http://briancaos.wordpress.com/2011/06/28/run-sitecore-scheduled-task-at-the-same-time-every-day/
全部設置爲異步執行和他們仍然向前爬。不幸的是,這個問題似乎並沒有很好的解決方案。 – Bryan
應該能夠保持滑動到最低限度,請參閱上面的編輯一個更多的想法。 – techphoria414
我剛剛檢查並將DB Agent設置爲每10分鐘運行一次,但我猜即使將其降至1分鐘之類。日程安排可能每天都在進行。 – marto