pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 469 forks source link

ts:rt:index should be allowed even if local daemon is not running #1245

Open akostadinov opened 1 year ago

akostadinov commented 1 year ago

Presently trying to index on a machine where sphinx is not running results in:

sh-4.2$ bundle exec rake ts:rt:index
The Sphinx daemon is not currently running. Real-time indices can only be
populated by sending commands to a running daemon.

But in production it is normal to run sphinx in a dedicated server/container. Where there is no rails or anything else, just the config file generated by thinking-sphinx.

I have to do something like:

nohup sleep 200000 &
echo $! > log/searchd.production.pid

And afterwards the command works. This is to trick the :running check to succeed. Note that presently also SIGHUP is sent to the process and it is checked for being present afterwards which is another thing that external sphinx does not need.

I think that this check is not necessary as things will fails with clear enough error message in case there is no running sphinx. But if it is useful to some, then at least there should be an option to skip that check.

akostadinov commented 1 year ago

I find it already has it. In configuration:

skip_running_check: true

Would be good for this to be documented. Also I found a curious issue. Running rake ts:stop with this option produces a process that sits waiting and kills any process it sees in pid file, whenever pid file is created. It made me mad.