Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:47:07+00:00 2026-05-30T00:47:07+00:00

I am seeking advice on how to poll RSS with a given interval such

  • 0

I am seeking advice on how to poll RSS with a given interval such as 6 hours.

The following code works, it reads and parses the feed and adds it to the database. It only adds new feeds. Here is the class method:

def self.update_from_feed(feed_url)
  feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing") #Example feed
  feed.entries.each do |entry|
    unless exists? :guid => entry.id
      create!(
        :name         => entry.title,
        :url          => entry.url,
        :published_at => entry.published,
        :guid         => entry.id
      )
    end
  end
end

How do I run this entire class method lets say, every 6 hours? I’m new to Ruby (and Rails), so any help would be appreciated with an example. I want to avoid running an external cron job if possible. I want it to run every 6 hours within the code if that makes sense. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:47:09+00:00Added an answer on May 30, 2026 at 12:47 am

    No, it doesn’t make sense to not use cron for this. This is what cron is for, it’s in the name of the program.

    If you don’t like the cron syntax, that’s cool, there’s a gem called whenever, https://github.com/javan/whenever that gives a nice Ruby syntax for generating a cron job and a command that lets you do that.

    However, for the love of god, do not try to invent a new way of doing this, unless you’re adding some killer features. Use cron, move on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm seeking advice on doing the following in a more pythonic way. Consider: class
I'm seeking a library, technique or advice on how to read an EAN-13 barcode
I'm seeking a solution to splitting a string which contains text in the following
I am newbie in Ruby.. seeking some help.. I have a code DB =
I'm seeking advice regarding adobe flex which has been currently incubated by Apache. Is
I'm seeking advice on best practice when submitting a varying number of POST variables.
I am seeking advice: Ideally, I would like to give an Administrator (of the
I am seeking some advice on what is the recommend way to use 'constant'
Looking to write an SNMP and Netflow tool for Linux\BSD and seeking advice on
I am seeking some web architecture advice: I would like to know how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.