We implemented a Servoy scheduler by using,
plugins.scheduler.addCronJob(‘scheduler1’,‘0 0/20 * * * ?’,globals.schedulerFunction);
Then, called the global method in the solution onOpen event. Then created a batch process for the solution.
The scheduler was set to run every 20 mins. However, whenever the scheduler runs, the application freezes for a few seconds. So, every 20 mins the solution freezes as the scheduler runs.
Is there any specific reason for this behavior? Is there anyway to fix this issue?
Thank you.
The solution freezes. Say I have the solution running and when the job begins to run, the solution freezes.
Say the job is to update a set of records every 20 mins. When I have the solution open, for some other task, it will freeze for a while when the job starts to run
Sounds to me that you are running the scheduled job in your client, not in just the batch processor.
Every client in itself is single threaded, so when you schedule something to run at a certain time using the scheduler plugin, no other activity is possible within that client for the duration of the scheduled process.
To run processes int he background, you can run a solution as a batchprocessor.
In general to run a process in a batchprocessor, you create a solution and in the onOpen method of the solution you arrange for the process to be kicked off (and if this is a repeating process, you can take care of the schedule interval here (or reschedule the process at the end of the process execution)). When you also allow users to use that same solution, you off course have to make sure that you do not schedule the process in those clients.
Most common way is to provide arguments to the batchprocessor and nly start the scheduled process when those arguments are set with specific values.