why jobs executed two times?

lock
push_pin
done
Beantwoord
2

Hi,

In Background we have implemented that SO Ticketsystem is not only System for our IT Service & Support, but also Billing System, each Ticket is a receipt for the Billing to our different Customer. At Beginning of each Month we send a group of Tickets for our monthly Billing of last month to them. in CRM Scripts this is two level Scripts, in Basic Scripts the single Tickets with all Message will be copied, in second Scripts where this Basic Scriptsc be called, an array of Tickets will be defined then copied and will be running in monthly scheduled Tasks. This Basic Scripts is also multiple called if user copy his single Tickets, and the Jobs for Copy array Tickets runs for several Months fine.

Now the Issues is, at begging of this Month (Feb.), the Jobs for Tickets was double executed, that means, our all Customer receive his double Billings. You see here the monthly Jobs is scheduled to excecuted at first day of each Month at 10:00, but the last Execution is at 10:19:

In fact all Tickets were double copied in Ticketsystem, once at scheduled 10:00, once at 10:20.

I have asked our local SO Support in Germany, they sent me the Protocol:

An exception occurred in script: "Start Recurring Tickets_monthly_Seidemann for Jobs" in include script: "copy_Recurring_tickets" at: line 60, char 3
Original exception: EjScript::RunTimeException:
Script is taking too long to execute. Execution time: 121.12, User CPU time: 7.31 at "copy_Recurring_tickets", line 60, char 3
  called from copyTicket(), declared in "copy_Recurring_tickets", line 3, char 6 

That means, the Jobs was double executed since its long Execution. But I don't unterstand, why long executed Jobs has two times excuted. Normally if Timeout was triggert, it should be stopped. Actually we have 32 Tickets in this Array to monthly Copy, and each Ticket has only one Message only with Text, each Tickets Copy lasts about 3-7 Sec. depends on connection. May be I need your Advice, if I break this long Jobs down in more Piece, for example, each Jobs copy no more then 10 Tickets, and the Execution time is nights at 3:15 then after 20 Min. for next Jobs to Copy next Array Tickets. 15 Min. for Lock Time and 15 Min. for Min. before Restart after Error should be enough.  Will it e OK to avoid later such Issues in Jobs?

many Thanks!

 

19 feb. 2024 | 11:42 a.m.

Alles Antwoorden (2)

Hi,

SuperOffice Online will kill a scheduled task if it runs longer then 60 seconds or hits one of the other limits.

So what happend here is your script was killed because it took to long and then was started (retried) again.

You should do the following:

  • Make sure that your scheduled task/script is re-entrant
    • So keep track of what ticket you already copied so that you do not do it again if the script is ran again
  • Optimize the script so that it does not hit one of the limits (not always possible, I know)
  • Refactor the script to only process x tickets per run so that you do not hit the limits
    • This entails making your own logic to determine if the desired action/work should be performed (Is it the first workday of the month? then copy these tickets) and then have the script run each hour (example) and take the work to be done in batches.
20 feb. 2024 | 09:00 a.m.

Hi david,

 

Ok i will do what you suggested. Here is the current second-level Scripts which is scheduled in Tasks below in Screenshots.

it will be started monthly on first calendar day. I will limit the numer of Tickets in Array in each Scripts so that it dosnot hit the Task Limit, that means I will allocate all Tickets to be copied in more second-level Scripts then schedule them in more jobs to be started in each hour Distence, and setup the Traces for all second-level Scripts.

Thanks!

20 feb. 2024 | 10:27 a.m.

Reply toevoegen