Skip to content
Snippets Groups Projects
Commit 39cc7c86 authored by Dan Notestein's avatar Dan Notestein
Browse files

Handle cases where current block being processed is only in the...

Handle cases where current block being processed is only in the blocks_reversible table (avoid returning 0 for a block).
parent a7146e11
No related branches found
No related tags found
3 merge requests!627merge in fix for get_current_block_age,!626Fix get_current_block_age function to avoid healthcheck fails,!625Handle cases where current block being processed is only in the...
Pipeline #117457 passed
......@@ -882,10 +882,13 @@ CREATE OR REPLACE FUNCTION hive.get_app_current_block_age(_contexts hive.context
STABLE
AS $BODY$
BEGIN
RETURN now() - (select min(coalesce(hafd.blocks.created_at, to_timestamp(0))) from
RETURN now() - (select min(coalesce(hafd.blocks.created_at, hafd.blocks_reversible.created_at, to_timestamp(0))) from
UNNEST(_contexts) AS context_names(name)
LEFT JOIN hafd.contexts USING(name)
LEFT JOIN hafd.blocks on num = hafd.contexts.current_block_num);
LEFT JOIN hafd.blocks on hafd.blocks.num = hafd.contexts.current_block_num
LEFT JOIN hafd.blocks_reversible on hafd.blocks_reversible.num = hafd.contexts.current_block_num AND
hafd.blocks_reversible.fork_id = hafd.contexts.fork_id
);
END;
$BODY$;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment