Topic: Threading in Controllers
I'm tracking web statistics in my application through a database table. I have my reasons so don't go asking why I'm not using the apache log or whatever The obvious side effect is that there's a database insert for every action thats called. My thought was to spawn a new thread for these inserts so they would be asynchronous.
So I did some reading on threads, and my only question is about how threads are terminated based on the execution of the controller. According to Programming Ruby "When a Ruby program terminates, all running threads are killed, regardless of their states. However, you can wait for a particular thread to finish by calling that thread's Thread#join method."
Does this mean that if I spawn a thread within the controller, and the thread takes longer to run than the controller, it will be prematurely terminated? If so, would the join method screw up the flow of the controller?