In my app in heroku I have a task that needs more than 30 seconds to execute and I can't increase the execution time because heroku won't allow that. I take data from an API in the front-end and then send it using AJAX to the server to insert this data to the database. This process in the server takes more than 30 seconds to complete and it gives me a timeout error.
I created the Procfile as below :
worker: cd ~/www/ && ~/php/bin/php worker.php
The file worker.php takes the data sent using AJAX and then inserts it into the database.
I enabled the worker in the heroku dashboard
What I want to achieve is start this worker only when I click a button that start the ajax call. I don't want to use heroku scheduler because this script will only be run once a month or whenever the client wants to add new products. Also if I use the scheduler I don't know how to send the data from the API to the server.
If this isn't possible is there a way to force heroku to increase the execution time?
Thank You