Forums

short scheduled task taking a long time

Lots of info about long-running tasks, my problem is the opposite. By design, my task exits early most of the time (conditions not met, so script terminates via exit() ). On the command line, this takes maybe one second. After uploading to PA and using the "Save & Run", it takes about 10 seconds, due to a new console being opened and initialized. However when it is run as a scheduled task, the logs say it takes 24-27 seconds.

If I run this once an hour, that's about 1/4th of my total daily console time -- for a process which would take about 1 second each time if run locally. Can I speed up the execution? Any way to have the scheduled task start the console quicker? Can I keep a console alive and re-use it on each run? Thank you.

That's not how cpu time is calculated. CPU time is time that your processes are using the CPU. If your scheduled task is waiting to run, it does not count against your CPU time.

Thanks Glenn, just wanted to confirm to other readers that this is in fact true. My CPU time is only 2-3% used each day, nowhere near the 25% I was concerned about. Despite that, I couldn't help but refactor the code to make it run faster :)