Frage

I've setup a "Whenever" task that truncates a "news" table, refreshes my sitemap, then repopulates the news table. All at 5am everyday. (This gets rid of old news items and fetches new ones using nokogiri.)

The problem is, every morning, i wake up and my news view is empty and I have to repopulate it manually...

This is the whenever task:

every 1.day, :at => '5:00 am' do
  runner "News.destroy_all"
  rake "-s sitemap:refresh"
  rake "rss:fetch"
end

Should I just make the fetch at 5:01 instead? or is there some other problem?

War es hilfreich?

Lösung

Since the table is emptied, the problem lies in one of both rake tasks. My guess is that you should remove the -s (silent) flag.

If I'm interpreting the whenever docs correct, a rake jobtype is defined as:

job_type :rake, "cd :path && :environment_variable=:environment bundle exec rake :task --silent :output"

So the output is already silenced.

Then again, there might be some other error in on of your tasks.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top