I created a workflow with a state machine. Going through the first two branches takes not a long time but from the second branch to the third takes 5 to 20 minutes! (Which is really annoying for testing the workflow!). If I disable the first two branches (except of the change state field) it takes 5 to 20 minutes to start.
What can I try to change to stop this? I read something about restarting timer service but I don't know how and what is timer service? Could something go wrong when restarting it?
Thanks in advance!
Solved! Go to Solution.
if you are using the state machine, the tranisition between the stages is realized by the workflow timer job. The workflow timer job is (by default) scheduled to run every 5 minutes. That means, when your workflow is reaching the "Change state" action, the state does not change immediately but has to wait for the timer job to get the work done. Imagine the timer job like a bus that is driving every 5 minutes and your workflow is waiting at the bus stop. If you are lucky, the workflow will be ready and the bus (timerjob) is just about to come in some seconds. But in the worst case you have to wait 5 minutes + additional time the timer job needs in case of heavy load on the system (a lot of traffic because holiday time is about to end).
It does not necessarily has to be something wrong in your system, this can be normal behaviour.
However, you can either reschedule the job to run every minute (this is the minimum) or you can start it manually ("run now" option). Both can be checked/updated in the central administration of sharepoint by navigating to Central Administration Site -> "Monitoring " -> "Review Job Definitions" -> Click on Job Definition with Title "Workflow":
Here you can lower the time between job executions or start it manually (by clicking "Run Now").
Safe looping could be the reason only if you have extensive looping logic inside of your workflow, which I don't see any indication for yet but we would need to see your workflow to be sure.
For restarting the timer service you have multiple options.
1. You can do this via Windows Server OS (Start Menu -> type "Services" -> find and restart "SharePoint Timer Service"):
2. You can do it via PowerShell:
3. You can do it via Command-Line:
net stop SPTimerV4
net start SPTimerV4
I have never experienced any problems when restarting the timer service. But if you want to be on the safe side, don't do it in your main business hours
Thank you so much!
It takes a long time between the second and third branch and I have one loop in my fourth branch (goes through 3 times and sends one notification and creates one item). Is it possible that safe looping is the reason for the waiting time? What happens when I turn it off? Can I turn it off while testing my workflow with good conscience? Thanks!