From 2b2d7f10f93ca11cff898e24fc5101bab1b8ed2d Mon Sep 17 00:00:00 2001 From: SatoshiQaziMuhammed Date: Sun, 18 Oct 2026 19:23:56 +0400 Subject: [PATCH] Give the deposit check's cron call a 60 s timeout so its result is kept (#36) pg_net's default 5 s timeout is shorter than the check, so every call since at least this morning was stored as a timeout and the function's result was lost. The function kept running; only the record was missing. --- .../20261018_deposit_cron_timeout.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 supabase/migrations/20261018_deposit_cron_timeout.sql diff --git a/supabase/migrations/20261018_deposit_cron_timeout.sql b/supabase/migrations/20261018_deposit_cron_timeout.sql new file mode 100644 index 0000000..e1bd36f --- /dev/null +++ b/supabase/migrations/20261018_deposit_cron_timeout.sql @@ -0,0 +1,19 @@ +-- The deposit check takes longer than pg_net's default 5 s timeout (about +-- 15-30 s with 53 users, as TronGrid requests go one at a time), so every call +-- was recorded as a timeout and the result it returns (deposits found, errors) +-- was never stored. The function itself runs on either way; with a 60 s +-- timeout net._http_response keeps each run's result. +SELECT cron.alter_job( + job_id := (SELECT jobid FROM cron.job WHERE jobname = 'check-deposits-job'), + command := $$ + SELECT net.http_post( + url := current_setting('app.settings.supabase_url') || '/functions/v1/check-deposits', + headers := jsonb_build_object( + 'Authorization', 'Bearer ' || current_setting('app.settings.service_role_key'), + 'Content-Type', 'application/json' + ), + body := '{}'::jsonb, + timeout_milliseconds := 60000 + ); + $$ +);