Skip to content

Commit

Permalink
add 'X-Priority-Reduced' (#413)
Browse files Browse the repository at this point in the history
Priority reduction

Clients wishing to avoid rate limiting may opt to schedule their change
task at a reduced priority. When the X-Accept-Reduced-Priority request
header is set to a true-ish value (e.g., 1), a client submitting a task
for execution can avoid rate limiting. If the user is being rate limited,
the task will be queued at a reduced priority rather than returning a 429
Too Many Requests.

If priority reduction occurs, the X-Priority-Reduced header is returned
with the 200 OK response. The header value is the task’s reduced priority
number (e.g., -7 or -9).

Clients should be prepared to receive a 429 Too Many Requests even if
the X-Accept-Reduced-Priority header is sent.

https://archive.org/developers/md-write.html#priority-reduction
  • Loading branch information
vasconsaurus authored Oct 31, 2023
1 parent 8f362ae commit 0c7fd98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/concerns/media_archive_org_archiver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def archive_org_request(request_url, verb)
http.use_ssl = uri.scheme == "https"
headers = {
'Accept' => 'application/json',
'Authorization' => "LOW #{PenderConfig.get('archive_org_access_key')}:#{PenderConfig.get('archive_org_secret_key')}"
'Authorization' => "LOW #{PenderConfig.get('archive_org_access_key')}:#{PenderConfig.get('archive_org_secret_key')}",
'X-Priority-Reduced' => '1'
}
[http, "Net::HTTP::#{verb}".constantize.new(uri, headers)]
end
Expand Down

0 comments on commit 0c7fd98

Please sign in to comment.