Skip to content

Commit

Permalink
WIP: Add server logging to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Madelyn Kasula committed Jun 17, 2020
1 parent 703cd91 commit fdd83ee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions shared/middleware/files_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def record_event(quota_event_type, quota_type, encrypted_channel_id)
#
get %r{/v3/(animations|assets|sources|files|libraries)/([^/]+)/([^/]+)$} do |endpoint, encrypted_channel_id, filename|
if endpoint == 'libraries'
puts "REQUESTING LIBRARY"
dont_cache
end
get_file(endpoint, encrypted_channel_id, filename)
Expand Down Expand Up @@ -201,6 +202,7 @@ def get_file(endpoint, encrypted_channel_id, filename, code_projects_domain_root
NewRelic::Agent.ignore_enduser rescue nil

buckets = get_bucket_impl(endpoint).new
puts "CREATED BUCKET" if endpoint == 'libraries'
cache_duration ||= buckets.cache_duration_seconds
set_object_cache_duration cache_duration

Expand All @@ -223,10 +225,13 @@ def get_file(endpoint, encrypted_channel_id, filename, code_projects_domain_root
response.headers['Content-Disposition'] = "attachment; filename=\"#{filename}\""
end

puts "GETTING FILE" if endpoint == 'libraries'
result = buckets.get(encrypted_channel_id, filename, env['HTTP_IF_MODIFIED_SINCE'], request.GET['version'])
not_found if result[:status] == 'NOT_FOUND'
not_modified if result[:status] == 'NOT_MODIFIED'
last_modified result[:last_modified]
puts "GOT FILE" if endpoint == 'libraries'
p result

metadata = result[:metadata]
abuse_score = [metadata['abuse_score'].to_i, metadata['abuse-score'].to_i].max
Expand Down

0 comments on commit fdd83ee

Please sign in to comment.