0

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?

mystic cola
  • 1,465
  • 1
  • 21
  • 39

1 Answers1

0

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.

zwippie
  • 15,050
  • 3
  • 39
  • 54
  • Not a chance! I've tested the hell out of these tasks. Individually they all absolutely work. I removed the "silent" from them though. So we'll see what it looks like tomorrow morning. I'll get back to you. – mystic cola Apr 18 '14 at 15:32
  • 10 o'clock and all is well! – mystic cola Apr 19 '14 at 20:06