Skip to content

Commit

Permalink
adjust retry delays
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianMindee committed Nov 14, 2024
1 parent c00f8d2 commit 1279d44
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/mindee/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def parse_queued(
# * `:on_min_pages` Apply the operation only if document has at least this many pages.
# @param cropper [Boolean, nil] Whether to include cropper results for each page.
# This performs a cropping operation on the server and will increase response time.
# @param initial_delay_sec [Integer, Float] initial delay before polling. Defaults to 4.
# @param delay_sec [Integer, Float] delay between polling attempts. Defaults to 2.
# @param initial_delay_sec [Integer, Float] initial delay before polling. Defaults to 2.
# @param delay_sec [Integer, Float] delay between polling attempts. Defaults to 1.5.
# @param max_retries [Integer] maximum amount of retries. Defaults to 60.
# @return [Mindee::Parsing::Common::ApiResponse]
def enqueue_and_parse(
Expand All @@ -162,8 +162,8 @@ def enqueue_and_parse(
close_file: true,
page_options: nil,
cropper: false,
initial_delay_sec: 4,
delay_sec: 2,
initial_delay_sec: 2,
delay_sec: 1.5,
max_retries: 60
)
enqueue_res = enqueue(
Expand Down Expand Up @@ -272,13 +272,13 @@ def create_endpoint(endpoint_name: '', account_name: '', version: '')
# @param max_retries [Integer, nil] maximum amount of retries.
def validate_async_params(initial_delay_sec, delay_sec, max_retries)
min_delay_sec = 1
min_initial_delay_sec = 2
min_initial_delay_sec = 1
min_retries = 2
raise "Cannot set auto-poll delay to less than #{min_delay_sec} seconds" if delay_sec < min_delay_sec
raise "Cannot set auto-poll delay to less than #{min_delay_sec} second(s)" if delay_sec < min_delay_sec
if initial_delay_sec < min_initial_delay_sec
raise "Cannot set initial parsing delay to less than #{min_initial_delay_sec} seconds"
raise "Cannot set initial parsing delay to less than #{min_initial_delay_sec} second(s)"
end
raise "Cannot set auto-poll delay to less than #{min_retries} seconds" if max_retries < min_retries
raise "Cannot set auto-poll retries to less than #{min_retries}" if max_retries < min_retries
end

# Creates an endpoint with the given values. Raises an error if the endpoint is invalid.
Expand Down

0 comments on commit 1279d44

Please sign in to comment.