Skip to content

Commit

Permalink
use delayed job to queue feed refresh requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wiggins committed Apr 14, 2009
1 parent 19f0517 commit e7db3f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/feed.rb
Expand Up @@ -4,6 +4,10 @@ class Feed < ActiveRecord::Base
after_create :fetch

def fetch
Delayed::Job.enqueue self
end

def perform
feed = FeedTools::Feed.open(url)

transaction do
Expand Down
2 changes: 1 addition & 1 deletion app/views/feeds/index.html.erb
@@ -1,4 +1,4 @@
<h1>Feed Reader - no queueing</h1>
<h1>Queueing Feed Reader</h1>

<form action="/feeds" method="post" />
<div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Feed Reader - no queueing</title>
<title>Queueing Feed Reader</title>
<%= stylesheet_link_tag 'main' %>
</head>
<body>
Expand Down

0 comments on commit e7db3f4

Please sign in to comment.