Skip to content

Instantly share code, notes, and snippets.

@arialdomartini
Created May 27, 2013 14:17
Show Gist options
  • Save arialdomartini/5657310 to your computer and use it in GitHub Desktop.
Save arialdomartini/5657310 to your computer and use it in GitHub Desktop.
synchronized on background job? Ha senso?
ClassMethod HousekeepingUnscheduledAdverts()
{
lock +^DateOfLastLifecycleUnscheduledAdsHK
set $ZTRAP = "Error"
if (..IsReschedulingEnabledNow()) {
set ^DateOfLastLifecycleUnscheduledAdsHK = ##class(Util.DateTime).Today()
do ##class(Util.Job).RunCommand("do ##class(JE.AdvertLifecycle.Scheduling.Data.AdvertSchedule.RescheduleUnscheduledAds()")
}
Error
set $ZTRAP = ""
lock -^DateOfLastLifecycleUnscheduledAdsHK
}
private synchronized static void housekeepingUnscheduledAdverts() {
if(isReschedulingEnabledNow()) {
Global.set(Util.DateTime.Today(), "^DateOfLastLifecycleUnscheduledAdsHK");
Job.RunCommand("JE.AdvertLifecycle.Scheduling.Data.AdvertSchedule.rescheduleUnscheduledAds()");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment