16 lines
522 B
PL/PgSQL
16 lines
522 B
PL/PgSQL
|
|
-- 12 times is too many, as it will retry the record task hours after a stream has gone offline. We're reducing retries to 6
|
|
DROP FUNCTION public.tg__add_record_job CASCADE;
|
|
CREATE FUNCTION public.tg__add_record_job() RETURNS trigger
|
|
LANGUAGE plpgsql SECURITY DEFINER
|
|
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
|
|
AS $$
|
|
begin
|
|
PERFORM graphile_worker.add_job('record', json_build_object(
|
|
'url', NEW.url,
|
|
'vod_id', NEW.id
|
|
), max_attempts := 6);
|
|
return NEW;
|
|
end;
|
|
$$;
|