Trigger with fixed delay instead of fixed rate


Is there a way to let me run tasks with fixed delay instead of fixed rate? Difference is explained here:

I made some workflows to refresh shop pages and check prices/stock. They run anywhere between 15s and 60s depending on which shop and items. Sometimes running workflows don’t finish fast enough and new ones are submitted and then more and more until none will process at all or I get database locked (when using SQLite, now migrated to PostgreSQL and increased number of connections - each workflow means one connection for some reason). The memory grows until all RAM is taken and after a while the whole instance dies.

Is there a way to run the workflow AFTER the previous task for that workflow is finished? That is, workflow ID 5 starts, workflow ID 5 finishes, timer ticks for 15 seconds and then workflow ID 5 starts etc. Currently the timer ticking starts the moment workflow is started.

In short I’m basically trying to prevent workflows from having multiple active running instances so that new workflow won’t be executing before the one and only one instance for that workflow is finished.

By the way, is there a reason why the new connection is made for each starting workflow instead of using a single currently open connection?