Just enqueue a job on service create for now, since our queues are empty. Resque status will let us run the job and show the user a spinny without locking up a thin

This commit is contained in:
Raphael Sofaer 2011-03-23 10:40:59 -07:00
parent 3e8f455cbc
commit 55c5b4e525
3 changed files with 9 additions and 4 deletions

View file

@ -102,6 +102,7 @@ class UsersController < ApplicationController
if @step == 3 if @step == 3
@requests = Request.where(:recipient_id => @person.id).includes(:sender => :profile).all @requests = Request.where(:recipient_id => @person.id).includes(:sender => :profile).all
@friends = service ? service.finder(:local => true) : {} @friends = service ? service.finder(:local => true) : {}
@friends ||= {}
@friends.delete_if{|key, value| @requests.any?{ |r| r.sender_id == value[:person].id} } @friends.delete_if{|key, value| @requests.any?{ |r| r.sender_id == value[:person].id} }
end end

View file

@ -8,7 +8,7 @@ class Service < ActiveRecord::Base
belongs_to :user belongs_to :user
has_many :service_users has_many :service_users
after_create do after_create do
Resque.enqueue(Job::UpdateServiceUsers, self.id) if s.respond_to? :save_friends Resque.enqueue(Job::UpdateServiceUsers, self.id) if self.respond_to? :save_friends
end end
def public_message(post, length, url = "") def public_message(post, length, url = "")

View file

@ -1,6 +1,10 @@
class Services::Facebook < Service class Services::Facebook < Service
MAX_CHARACTERS = 420 MAX_CHARACTERS = 420
after_create do
Resque.enqueue(Job::UpdateServiceUsers, self.id)
end
def provider def provider
"facebook" "facebook"
end end