fixes remove debugs
parent
881b65f6a5
commit
47eb738400
|
@ -14,10 +14,10 @@ class LoadUserActivitiesJob < ApplicationJob
|
||||||
last_spotify_activity_at = latest_activity_iso(login.platform)
|
last_spotify_activity_at = latest_activity_iso(login.platform)
|
||||||
new_activities = client.load_since(last_spotify_activity_at)
|
new_activities = client.load_since(last_spotify_activity_at)
|
||||||
# log some info about the response with status and parts of the body
|
# log some info about the response with status and parts of the body
|
||||||
Rails.logger.info("Response: #{new_activities}")
|
Rails.logger.info("Response status: #{new_activities&.status}")
|
||||||
create_action = CreateSpotifyActivity.new(user, new_activities)
|
create_action = CreateSpotifyActivity.new(user, new_activities)
|
||||||
create_action.perform
|
create_action.perform
|
||||||
logger.info("Loading for #{user.id} finished with #{new_activities.size} new activities")
|
logger.info("Loading for #{user.id} finished with")
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
Rails.logger.error(e)
|
Rails.logger.error(e)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,6 @@ class CreateSpotifyActivity
|
||||||
begin
|
begin
|
||||||
# log some info about the response with status and parts of the body
|
# log some info about the response with status and parts of the body
|
||||||
Rails.logger.info("Response status: #{response["status"]}")
|
Rails.logger.info("Response status: #{response["status"]}")
|
||||||
Rails.logger.info("Response body: #{response["body"]}")
|
|
||||||
counts = response["items"].size
|
counts = response["items"].size
|
||||||
Rails.logger.info("Saving #{counts} activities")
|
Rails.logger.info("Saving #{counts} activities")
|
||||||
response["items"].reverse.each do |play|
|
response["items"].reverse.each do |play|
|
||||||
|
|
|
@ -42,12 +42,12 @@ class SpotifyClient
|
||||||
call(path, params)
|
call(path, params)
|
||||||
rescue RestClient::ExceptionWithResponse => e
|
rescue RestClient::ExceptionWithResponse => e
|
||||||
if e.response.code == 401
|
if e.response.code == 401
|
||||||
puts "token expired, forcing refresh"
|
Rails.logger.info("token expired, forcing refresh")
|
||||||
refresh_token!(force: true)
|
refresh_token!(force: true)
|
||||||
begin
|
begin
|
||||||
call(path, params)
|
call(path, params)
|
||||||
rescue RestClient::ExceptionWithResponse
|
rescue RestClient::ExceptionWithResponse
|
||||||
puts "token dead"
|
Rails.logger.info("token dead")
|
||||||
LogLoadFailedWorker.perform_async(login.id)
|
LogLoadFailedWorker.perform_async(login.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue