Hi there guys,
I am using gem daemon, instead of cron job, to periodically rebuild
sphinx delta index. The reason is that my data update very frequently
and I want to udpate the delta index every 10 seconds or so, whereas
cron job can not be scheduled in seconds.
I tried to run rake command in the daemon to rebuild index for sphinx.
But the rake command is never successfully executed. The source code
is as following. I just don't know what is going on.
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= "development"
require File.dirname(__FILE__) + "/../../config/environment"
$running = true
Signal.trap("TERM") do
$running = false
end
while($running) do
time_start = Time.now
system "/usr/local/bin/rake thinking_sphinx:index:delta"
time_finish = Time.now
time_span = time_finish - time_start
ActiveRecord::Base.logger.info "/usr/local/bin/rake
thinking_sphinx:index:delta --- #{time_span} seconds. \n"
sleep 10
end
Ryan mentioned in <a href="http://railscasts.com/episodes/127-rake-in-
background">http://railscasts.com/episodes/127-rake-in-background</a>
that rake task is quite resource-consuming for frequent using. So I am
wondering whether I am even in the right track or not.
I tried command
" system 'rake thinking_sphinx:index' " in IRB and controller action,
it worked in both cases. It seems that it dose not work only in the
daemon. Any ideas?
Thank you very much. Any suggestion is appreciated.
cheers
--
Canvas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---