I need a 'keep-alive' procedure that runs frequently to prevent a service from 'spooling down.' The procedure I wrote works perfectly when I execute it directly from SQL Developer using the command EXECUTE keep_alive;
.
This procedure calls a rest-api service using:
apex_web_service.oauth_authenticate
( p_token_url => l_token_url
, p_client_id => l_client_id
, p_client_secret => l_client_secret
, p_scope => l_scope
);
However, when I create a scheduler job to run the procedure every 5 minutes, I receive a {"code":502,"message":"Bad Gateway"}
response from the API that the keep_alive
procedure calls. The procedure does not require any parameters, and the job is created within the same schema as the procedure.
What could be causing this discrepancy in behavior?