I have a project that requires a standalone server for background processing. I could have used backgroundrb but it seems like overkill, and it has this comment on the documentation page, which is a year old, and which tells me the gem is not in active development.
WARNING: start/stop/restart is broken in 0.2.1, please use the server script directly until we have figured out the issue.
So, in development mode, rather than start a standalone server, I put this code in development.rb:
Thread.new do
Server.start()
end
For reasons i’ve yet to determine, because the thread is started in the initialization code, the file include logic doesn’t work properly. Now, this could be a problem with DRb, which is how the server talks with the rest of the app, or it could be a problem with the file include logic in rails. Either way, the first attempt to contact the server works, and on the second attempt to contact the server, we get this error:
A copy of Server has been removed from the module tree but is still active!
For now, I’m just running the server using script/runner in a separate process, and it works fine.