daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def refresh
  2.         local_to_date = nil
  3.         local_from_date = nil
  4.  
  5.         if (request.has_field?(:to_date))
  6.           local_to_date = Time.at(request.to_date).utc.to_i
  7.         else
  8.           request.to_date = Time.new.to_i
  9.         end
  10.  
  11.         if (request.has_field?(:from_date))
  12.           local_from_date = Time.at(request.from_date).utc.to_i
  13.         else
  14.           request.from_date = 1.day.ago.to_i
  15.         end
  16. # puts 'before refresh call'
  17.         self.async_responder = true
  18.         Atlas::Persona::MemberRefreshService.client(:async => true).refresh(request) do |c|
  19.  
  20.           c.on_failure do |error|
  21.             rpc_failed error
  22.           end
  23.  
  24.           c.on_success do |persona_response|
  25.             begin
  26. <<<<<<< HEAD
  27. =======
  28.               #SyncSystem.account_sync(request.member_guid, persona_response.accounts, request.from_date, request.to_date)
  29.               unless persona_response.accounts.empty?
  30.                 proto_account_guids = persona_response.accounts.map {|a| a.guid}
  31.                 db_accounts = ::Account.where("guid IN (?) AND (status = ? OR status = ?)", proto_account_guids, Atlas::StatusType::ENABLED.value, Atlas::StatusType::HIDDEN.value)
  32.                 db_accounts.each {|a| response.accounts << a.to_proto(local_from_date, local_to_date, true)}
  33.               end
  34. >>>>>>> d30a6109a92cab5fc543461c725601d5303060da
  35.  
  36.               db_accounts = ::Account.where("member_guid = ? AND (status = ? OR status = ?)", request.member_guid, Atlas::StatusType::ENABLED.value, Atlas::StatusType::HIDDEN.value)
  37.               #db_accounts = ::Account.where(:member_guid => request.member_guid, :status => Atlas::StatusType::ENABLED)
  38.               db_accounts.each {|a| response.accounts << a.to_proto(local_from_date, local_to_date, true)}
  39.  
  40.               response.status = persona_response.status
  41.               response.member_status = persona_response.member_status if persona_response.has_field?(:member_status)
  42.  
  43.               send_response
  44.             rescue => e
  45.               # puts 'error'
  46.               # puts e.message
  47.               rpc_failed "Refresh was successful in Persona, but failed in Abacus! Error => #{e.message}"
  48.             end
  49.           end
  50.  
  51.         end
  52.  
  53.       end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top