As title mentions im having an issue with google appscript timed triggers in my script.
I have a main function that processes and matches a ton of data (43k rows) so im using timed triggers to stop the process and restart where it left off. It saves its data in properties service.
the function calls the set trigger function ive written (which sets a 1 second trigger) then immediately stops itself.
here is my called trigger function
// Function to set a timmed trigger to start the main function again.
function setrebootTrigger() {
//manageTriggers(); disabled to see if this speeds things up FYI it didnt :/
//Set a time-based trigger to continue processing after 1 seconds
ScriptApp.newTrigger('organizeData')
.timeBased()
.after(1000)
.create();
// logToSheet("Freeze process trigger created."); disabled currently not needed for debugging
}
and here is a link to the whole script
https://github.com/caveman1514/RT-YT-match-script/blob/main/Rt%20-%20YT%20Script%20V5.txt
No matter how long I set the trigger to 1 sec, 5 sec, 20 sec, 1/2 sec it takes around 1-3 min to activate the main function again. I’ve set logs to see if its stalling when it pulls the data where it left off and even had a log right after the main function starts every time and before it stops itself after setting the trigger and those two logs had a 1-3 min separation so it’s to do with the trigger itself.
here are some logs if you want to see
15/05/2024 11:58:13 AM: Batch update completed.
15/05/2024 11:58:15 AM: Properties updated. Ending current iteration of loop.
15/05/2024 11:58:16 AM: freeze process trigger set, freezing process to avoid timeout
15/05/2024 11:59:30 AM: main function started!
15/05/2024 11:59:31 AM: Set YouTube batch size to 50 and RoosterTeeth batch size to 1500.
15/05/2024 11:59:31 AM: Set desired show name: On The Spot
15/05/2024 11:59:32 AM: Processing new batch of YouTube rows from index 100 to 150.
another set of logs
15/05/2024 11:53:38 AM: Batch update completed.
15/05/2024 11:53:39 AM: Properties updated. Ending current iteration of loop.
15/05/2024 11:53:40 AM: freeze process trigger set, freezing process to avoid timeout
15/05/2024 11:55:14 AM: main function started!
15/05/2024 11:55:15 AM: Set YouTube batch size to 50 and RoosterTeeth batch size to 1500.
15/05/2024 11:55:16 AM: Set desired show name: On The Spot
15/05/2024 11:55:16 AM: Processing new batch of YouTube rows from index 50 to 100.
as you can see its really inconsistent, and when i pull up the triggers tab i can see it just sitting then doing nothing
user25065751 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.