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