Skip to content

Commit 189760c

Browse files
authored
Update 20260226142941_passive_mining_cron_job.sql (#2620)
* Update 20260226142941_passive_mining_cron_job.sql * Update 20260226142941_passive_mining_cron_job.sql * Update 20260226142941_passive_mining_cron_job.sql
1 parent 8427abb commit 189760c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

supabase/migrations/20260226142941_passive_mining_cron_job.sql

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,17 @@ AS $$
66
DECLARE
77
project_url TEXT;
88
response JSONB;
9-
payload JSONB;
109
BEGIN
11-
-- Fetch the base URL from Vault
1210
SELECT decrypted_secret INTO project_url
1311
FROM vault.decrypted_secrets
1412
WHERE name = 'project_url';
1513

16-
-- Validate secrets
1714
IF project_url IS NULL THEN
1815
RAISE EXCEPTION 'project_url is missing';
1916
END IF;
2017

21-
-- Perform HTTP POST to Edge Function
2218
response := net.http_post(
23-
url:= project_url || '/functions/v1/' || edge_function_name,
19+
url := project_url || '/functions/v1/' || edge_function_name,
2420
headers := jsonb_build_object(
2521
'Content-Type', 'application/json'
2622
)
@@ -30,10 +26,8 @@ BEGIN
3026
END;
3127
$$;
3228

33-
34-
3529
SELECT cron.schedule(
3630
'passive-cron-job',
37-
'0 2 * * *', -- At 02:00 AM
38-
$$ SELECT execute_edge_function('passive-mining'); $$
31+
'0 2 * * *', -- At 02:00 AM
32+
$$ SELECT invoke_edge_function('passive-mining'); $$
3933
);

0 commit comments

Comments
 (0)