Update main process function is retruning result.

Ensure the query is successful for process_logbook_queue_fn and process_stay_queue_fn
This commit is contained in:
xbgmsharp
2023-01-31 21:17:49 +01:00
parent 4eef5595bc
commit 93f8476d26

View File

@@ -162,6 +162,12 @@ CREATE OR REPLACE FUNCTION process_logbook_queue_fn(IN _id integer) RETURNS void
AND _from_lat IS NOT NULL AND _from_lat IS NOT NULL
AND _to_lng IS NOT NULL AND _to_lng IS NOT NULL
AND _to_lat IS NOT NULL; AND _to_lat IS NOT NULL;
-- Ensure the query is successful
IF logbook_rec.client_id IS NULL THEN
RAISE WARNING '-> process_logbook_queue_fn invalid logbook %', _id;
RETURN;
END IF;
PERFORM set_config('vessel.client_id', logbook_rec.client_id, false); PERFORM set_config('vessel.client_id', logbook_rec.client_id, false);
--RAISE WARNING 'public.process_logbook_queue_fn() scheduler vessel.client_id %', current_setting('vessel.client_id', false); --RAISE WARNING 'public.process_logbook_queue_fn() scheduler vessel.client_id %', current_setting('vessel.client_id', false);
@@ -237,6 +243,12 @@ CREATE OR REPLACE FUNCTION process_stay_queue_fn(IN _id integer) RETURNS void AS
WHERE id = _id WHERE id = _id
AND longitude IS NOT NULL AND longitude IS NOT NULL
AND latitude IS NOT NULL; AND latitude IS NOT NULL;
-- Ensure the query is successful
IF stay_rec.client_id IS NULL THEN
RAISE WARNING '-> process_stay_queue_fn invalid stay %', _id;
RETURN;
END IF;
PERFORM set_config('vessel.client_id', stay_rec.client_id, false); PERFORM set_config('vessel.client_id', stay_rec.client_id, false);
-- geo reverse _lng _lat -- geo reverse _lng _lat
_name := reverse_geocode_py_fn('nominatim', stay_rec.longitude::NUMERIC, stay_rec.latitude::NUMERIC); _name := reverse_geocode_py_fn('nominatim', stay_rec.longitude::NUMERIC, stay_rec.latitude::NUMERIC);