more debugging
parent
2b1ddcf8c8
commit
881b65f6a5
|
@ -13,6 +13,8 @@ class LoadUserActivitiesJob < ApplicationJob
|
||||||
client = SpotifyClient.new(login)
|
client = SpotifyClient.new(login)
|
||||||
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
|
||||||
|
Rails.logger.info("Response: #{new_activities}")
|
||||||
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 #{new_activities.size} new activities")
|
||||||
|
|
|
@ -8,6 +8,7 @@ class CreateSpotifyActivity
|
||||||
|
|
||||||
# rubocop:disable Metrics/AbcSize
|
# rubocop:disable Metrics/AbcSize
|
||||||
def perform
|
def perform
|
||||||
|
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"]}")
|
Rails.logger.info("Response body: #{response["body"]}")
|
||||||
|
@ -24,6 +25,11 @@ class CreateSpotifyActivity
|
||||||
activity.started_at = DateTime.parse(play["played_at"])
|
activity.started_at = DateTime.parse(play["played_at"])
|
||||||
activity.save!
|
activity.save!
|
||||||
end
|
end
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error("[CreateSpotifyActivity] Error: #{e.message}\n#{e.backtrace.join("\n")}")
|
||||||
|
Rails.logger.error("[CreateSpotifyActivity] Response object: #{response.inspect}")
|
||||||
|
raise e
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/AbcSize
|
# rubocop:enable Metrics/AbcSize
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue