I am building an application that requires users to complete a short
tutorial after registration in order to fully activate their account.
When a user registers, they get an email saying something like “thanks
for registering. Please complete the tutorial by clicking here”
which links to the tutorial. However, after filling out the
registration form, the “thank you for registering” page includes a
button to go to the tutorial.
Thus, it’s a little weird to have the email go out if they just
clicked the button and went right into the tutorial.
What I’m thinking of doing is this:
When the registration form is submitted, spawn a thread that sleeps
for 1 hour. Then, after the hour, check and see if the member has
completed the tutorial. If not, send the “please complete the
This way, if the user goes right into the tutorial after registering,
the email doesn’t go out, thus confusing them.
So that’s the business logic. What I’m worried about, and would love
some input on, is the pros/cons of spawning threads (possibly with the
Spawn plugin) and having them sleep for 1 hour (or 1/2 hour or
whatever). I don’t predict a huge influx of members (it’s an invite-
only website), but I don’t know enough about how Rails will perform
under lots of spawned threads. Also, would there be memory leak
issues? If after the thread wakes and does it’s thing, how can I be
sure it fully dies?
Am I crazy to think of it this way? Should I just background-job it or
BTW, I’m currently running NginX and Thin, but I’m amenable to a
Thanks for any intelligence you can provide on this!