Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sleeping in controller

In my Rails controller method, which is executed when the user submits a form, there is a Ruby code sleep(60), telling it to wait for a minute. One user submits the form, and while the execution is "sleeping", another user submits the form. Will the second user have to wait for the first user to finish, or will the execution of the controller start for the second user?

like image 687
JJ Beck Avatar asked Nov 02 '12 20:11

JJ Beck


1 Answers

Both users will wait for 60 seconds only, they will not depend on each other. As request will be processed separately for each other. Hence no dependency

like image 162
Akshay Vishnoi Avatar answered Sep 28 '22 06:09

Akshay Vishnoi