Hi,
Hi i have a question about timer and long pooling,Right now my timer is running every 5 min's and thrown an exception every one hour(refer the screen shot) i am not sure why it is happened and my action process no end activity since it is long polling which means should be running everyday (8 am - 8pm ) .
Please suggest how to fix the timer issue.
Another question do we need to set the timer should run 8AM - 7PM using weekly process or any
Error Log:
Hi Ganesh,
Your timer never finishes... there's no End node in your flow, so it is on an endless loop. This is BAD. Because of the timer never ending, at some point it will always time out (the platform will enforce whatever timeout was configured, but I guess long before your 3.75 days have passed something will go wrong).
What is the purpose of the timer??? Why is it on an infinite loop?
Also, it doesn't make much sense to have a timer schedule to run every 5min with a timeout of 90h...
Jorge Martins wrote: Thanks your response. Long polling(endless process) will trigger using server action since no web screen page and action) so i have to run the process via TIMER only and choose "Daily"(Effective scheduler Days) and run the timer interval every 5 mins if server action throw any exception so we need to re trigger so i have choose Daily with interval 5 mins.
1) Please suggest alternative way to trigger server action when exception raised in server action?
2) any scheduler instead of Daily with every 5 mins run the timer to avoid timer exception.
3) They want to run 9am- 6PM(working hours) so i thought to set default time out 9 hours (5400) and won't throw time out exception but i thing that is also make problem as per below screen shot
4) Server action will trigger by timer then process will not back to start node and keep calling Longpooling REST API response with in 3 seconds(refer below screen shot).will call again REST API(next to start node) process if we are not getting any response from REST API and it is continue process.
Ganesh Kumar wrote:
3) Server action will trigger by timer then process will not back to start activity and keep calling Longpooling REST API response with in 3 seconds(refer below screen shot).will call again REST API(next to start action ) process if we are not getting any response from REST API and it is continue process.
Ans - If you need to trigger timer on exception of error then you need to update next run field in Cyclic_Job entity in database.
Thanks,
Rajat Agrawal
Rajat Agrawal wrote:
Kindly share the example(cyclic example with call entity in server action) will help me lot also looking for questions answer
Sure, I will give. Give me sometime.
Thanks your support to overcome my issue also looking for other queries answer
Why...
J. wrote:i am not understanding what you are saying
Ganesh,
A Timer is nothing more than a schedule for the platform to execute your code. So you don't have to worry about executing it, the system will take care of that and guarantee that it will be executed as close to schedule as available resources allow.
1) Your timer is running every 5min... if you let it finish, it will run again at the next schedule, no point abusing the server resources doing an endless loop. And it actually has a negative impact, as any changes performed on entities will be rolled back when the timer aborts.
2) Setting a schedule of 5min has no impact on timeouts... it just mean that the platform will try to trigger the execution of your action every 5min, unless a previous timer instance is still running.
3) In your effective schedule, if you want the timer to run every 5min between 9am and 6pm, just set the time to 09:00 9:05 9:10 (...) 17:50 17:55 18:00. If it's just relevant during work works, then I assume its also work days? If that's the case, instead of using Daily, you may consider setting it to Weekly and choose Mon-Fri (so it will not run on weekends).
4) I don't understand your action flow or needs (nor does J. above). Please explain your requirements and why you need to keep calling a web-service every 3 seconds?
Jorge Martins wrote:
Hi Jorge,
My action is a continues listener(webservice call) which will always waits for an event to happen.For example we will have a camera which always waits for a person to come in front of it. when ever person detected my action should perform some set of operations.
To make this happen my action should run with no time gap because of which I can't have end activity in the action. Now it is working properly but the problem is for every 1hour thread gets aborted and Logging Error for every 1hour in servicecentre.
I want to how to prolong this 1hour to 12 hours and where can i set this.
we tried to do it as shown in the screen shot but, It is not considering the 12hours and giving exception for every 1hour as "System.Threading.ThreadAbortException: Thread was being aborted".
To give my 2 cents, I agree with Jorge as bad pattern.When you say it must react when people get into the camera, why don't you do it from the other way? The trigger should be made from the camera.To also give a suggestoin about comment below:
In the proces that is called by the timer, just start with a check on 'day of the week', if its saterday/sunday, stop the proces.Kind regards,Evert
I'd say you're using the wrong tool for the job. You seem to want to react in near-realtime to events... in that case I don't think timers are the way to go.
I'd try and see if you can have the camera system to:
If you're dead sure you want to use timers, follow the best practices and build them in such a way that they work well with others and their work isn't wasted/rolled back because of timeouts:
I will repeat, your current implementation of a timer seems generally a BAD solution, no mater your requirements.
Sorry for creeping into this old thread, but I found that this page is easily reached from Google, so it might help other people to link in here to a thread where I explain a proper way of implementing timers that need to keep running uninterruptedly: Long Polling/Continuous-Process Timer pattern (done right!)
Cheers.