remove debug messages and add rescues
This commit is contained in:
parent
e9533fb056
commit
94c2edfbe1
|
@ -159,12 +159,11 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_first_login(user)
|
def check_first_login(user)
|
||||||
return if user.first_logged_in_at
|
return unless Travis.config.customerio.site_id
|
||||||
puts "******** This is the first log in for " + user.login + " **********"
|
|
||||||
# update user
|
# update user
|
||||||
timestamp = Time.now
|
unless user.first_logged_in_at
|
||||||
puts "Updating first_logged_in_at with " + timestamp.to_s
|
user.update_attributes(first_logged_in_at: Time.now)
|
||||||
user.update_attributes(first_logged_in_at: timestamp)
|
end
|
||||||
# send event to customer.io
|
# send event to customer.io
|
||||||
customerio = Customerio::Client.new(Travis.config.customerio.site_id, Travis.config.customerio.api_key, :json => true)
|
customerio = Customerio::Client.new(Travis.config.customerio.site_id, Travis.config.customerio.api_key, :json => true)
|
||||||
payload = {
|
payload = {
|
||||||
|
@ -175,9 +174,10 @@ class Travis::Api::App
|
||||||
:created_at => user.created_at.to_i,
|
:created_at => user.created_at.to_i,
|
||||||
:github_id => user.github_id,
|
:github_id => user.github_id,
|
||||||
:education => user.education,
|
:education => user.education,
|
||||||
:first_logged_in_at => timestamp.to_i}
|
:first_logged_in_at => user.first_logged_in_at}
|
||||||
puts "Sending payload to Customer.io: " + payload.to_s
|
|
||||||
customerio.identify(payload)
|
customerio.identify(payload)
|
||||||
|
rescue StandardError => e
|
||||||
|
Travis.logger.error "Could not update Customer.io for User: #{user.id}:#{user.login} with message:#{e.message}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def serialize_user(user)
|
def serialize_user(user)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user