Custom code can be run minimum to 1 per minute. There is a limitaion of execution time and it should get competed in 10 seconds.
If you think that your request might take more than 10 seconds and need more control on the code, you have to consider App42PaaS in that case. See here for more details.