Skip to content

Coordinated Interval Chain Execution across multiple clients #663

Answered by pashagolub
radim asked this question in Q&A
Discussion options

You must be logged in to vote

Interval chains explicitly are designed with the idea of the client independence. That means client itself controls when the next execution is started. If we are talking about several pg_timetable clients that needs to be synchronized the simplest way would be to switch to regular cron with least common interval.

Another solution might be to check timetable.execution_log.finished value for chain as a first task and decide if we want to proceed.

DO $$
BEGIN
	IF now() - max(finished) < '30 seconds' FROM timetable.timetable.execution_log el WHERE chain_id = 1 THEN
		RAISE EXCEPTION 'aaaah, too early!';
	END IF; 
END;$$

Set ignore_error for this task to TRUE and set max_instances to 1 for the…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@radim
Comment options

@pashagolub
Comment options

Answer selected by radim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
❓ question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #662 on November 19, 2024 13:19.