Ruby on Rails: Is using the sleep command bad? Multithreading -


i new web development , multithreaded , have question on of concepts.

in rails app, clients able submit "jobs" through form. each time job created passed module called "dispatcher", , dispatcher module must wait 3 minutes before performing additional task.

in order this, proposed run sleep 3 minutes.

my partner said bad idea because freeze app 3 minutes everytime job created.

my problem dont see how possible. whenever client connects our app (hosted on aws elastic beanstalk), assume ec2 server spins new thread handle clients request. whenever client creates job, cause thread running app sleep 3 minutes. shouldn't problem because want our app nothing until 3 minutes over.

can please tell me if concepts correct. want understand how works client making request, server processing it, sending html , javascript client.

this has nothing ec2. ec2, part, isn't different regular server environment.

keeping request open 3 minute bad. in many scenarios have front end web server handing off request cgi process. in case ruby. if there no response within 30-60 seconds, web server close connection. can increase timeout, might run limits number of open connections.

the best solution senario send delayed message queue processed 3 minutes later.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -