'Sunspot RSolr Reindex Error ConnectionRefused After reindexing 99.57% of the model How to continue from where it failed

I have a Rails 5 app that uses the following gems:

gem 'sunspot'
gem 'sunspot_rails'
gem 'sunspot_solr'

I'm reindexing one of my models by running:

bundle exec rake RAILS_ENV=production sunspot:solr:reindex[100,Clip]

It started running OK and reindexed 99.57% of the model as you can see in the next image:

enter image description here

However there was this error: RSolr::Error::ConnectionRefused: Connection refused. In the other threads that I read all people had this problem due to poor configuration or not starting the solr. But in this case the solr was running fine.

Is it possible to start reindexing from where it failed? Because 61800 out of 62066 rows took 8:35 hours to reindex and there are only 266 rows left to reindex.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source