title: (RAILS) Looping a Custom Rake every 2 mins, Bad Idea? Better way to implement?
body: <p>I've currently created a custom rake file that does the following: </p>
  
  <p>1.) Checks an External Feed for "NEW" Items </p>
  
  <p>2.) For each <em>new</em> item in the feed array,it updates my Database with a new record </p>
  
  <p>3.) I've currently got it on a WHILE loop.  The while loop has an (@loopcheck) instance variable that is set to true initially, and if any exception is raised. Resets it to false (so the loop ends). </p>
  
  <p>Here's an example:</p>
  
  <pre><code>   While(@loopcheck) do 
        begin
         ....(code here)...
        rescue
          Exception =&gt; e
          @loopcheck = false
        end
        sleep(120)
     End
  </code></pre>
  
  <p>Is this bad coding? Is there a better way to do this?  Ideally, I just want to run a background task to simply check for a new feed every 2-3 mins.  I looked into Starling/Workling, but that seemed a bit like overkill, and I wasn't sure about running script/runner via CRON, since it reloads the entire rails environment each time.  BackgroundRB a bit overkill too? No? </p>
  
  <p>Just wanted to get some ideas.</p>