def check_expired_resources
      net_resources = ::NetResource.expired
      net_resources.each do |resource|
        http = EM::HttpRequest.new(resource.url).get

        http.callback{ |response|
          resource.set_next_update
          if resource_changed?(resource, response)
            resource.body = response.response
            update_changed_resource(resource, response)
            notify_subscribers(resource)
          end
        }
        http.errback {|response|
          # Do something here, maybe setting the resource
          # to be not checked anymore.
        }
      end
    end
def check_expired_resources
      net_resources = ::NetResource.expired
      net_resources.each do |resource|
        http = EM::HttpRequest.new(resource.url).get

        http.callback{ |response|
          resource.set_next_update
          if resource_changed?(resource, response)
            resource.body = response.response
            update_changed_resource(resource, response)
            notify_subscribers(resource)
          end
        }
        http.errback {|response|
          # Do something here, maybe setting the resource
          # to be not checked anymore.
        }
      end
    end
Adds a periodic timer to the Eventmachine reactor loop and immediately
 starts grabbing expired resources and checking them.

 Gets all of the expired NetResources from the database and sends an HTTP
 GET requests for each one.  Subscribers to a NetResource will be notified
 if it has changed since the last time it was grabbed.