Recently I was playing around with methods to delay actions within my automations in Coda. I have a Coda doc that pulls in data from multiple Google Sheets, so this was mostly to pad out enough time for each Sheet to refresh fully (via RefreshTable
) before moving on to other functions.
I tried out:
- The Delay Pack
- The Scheduler Pack
- Coda’s built-in
_delay
method
Here are some things I discovered for anyone that can use it.
The Delay Pack
This works pretty well and does basically exactly what it says. You add a Delay
function into your automation, and then you can delay the automation for up to 60 seconds.
The problem with the Delay Pack is that if you try to run multiple delays in a row, it doesn’t work. It’ll error out after a certain number of delays, saying “Delay error: Delay took too long to respond”
This can be a issue if you need to chain together a lot of delayed events, or if you need a delay longer than 60 seconds.
The Scheduler Pack
The way the schedule pack supposedly works is: you input either IDs or names for the specific button and location (doc, table, etc) into the Scheduler’s interface, click run, and then an outside interface is supposed to click your button.
This doesn’t appear to work, however. I followed the instructions from the pack’s wiki, tried to push a button via names and IDs, and even tried pulling in the IDs for my button & its location from [Coda API (v1) Reference Documentation](https://Coda’s API). No luck.
I’ve reached out to the developer via his contact form for Coda. He seems to have a lot of active projects though, and I believe his main one is likely sync2sheets, so I’m not really expecting a fast reply.
For now, even though it seems to be from a reputable source, I’d probably avoid this pack. I’ll likely follow-up in a separate thread about the specifics of my test.
Coda’s built-in _delay
method
This was the only method I could get to work well enough. Even though it’s one of the hidden built-ins and has some quirks, I’d recommend just using this. You can set whatever delay you want, set longer delays, chain numerous delays back to back, etc. and it mostly just works.
The only drawback I’ve found - when using longer delays, events are not guaranteed to delay the exact amount and will sometimes delay for longer. For example, I set 5 actions at 5 minutes apart, but some actions ran after 6 or 8 minutes for their delay.
Here’s an example case:
RunActions(
RefreshTable("table_name"),
_delay(
RefreshTable("table_name"),
60000
),
_delay(
RefreshTable("table_name"),
60000
),
some_other_action
)
Very straightforward. All you should need to do is wrap your action with the _delay
function and it’ll fire off correctly.
The best part about this function is that when you chain it with other delay events, the automation will wait until each delay has finished before continuing to the next step. Meaning, it doesn’t queue delays to be run later and instead runs them linearly.
For example, if you have another action at the end (or middle) of the delays, like the above some_other_action
, some_other_action
won’t fire until the full two minutes have finished for the previous delays.
Also, my full function with 15 delays spaced 5 minutes apart ran perfectly. So even with an automation running for over an hour, this worked. There doesn’t seem to be a limit for how long you can set a delay.
Overall, pretty great function. Glad I found it. Otherwise I wouldn’t have a fully working automation.
Other Threads
This was a continuation of another thread - (Wait) Is there a way to make automations wait to fire?. I’d rather comment there, but I suppose Coda deactivates help threads for whatever reason.