naota7118 / ocr_check_app

0 stars 0 forks source link

Google::Apis::TransmissionError in MocaDataController#result #36

Closed naota7118 closed 1 month ago

naota7118 commented 1 month ago

Google Drive APIでタイムアウトエラーになった。

スクリーンショット 2024-08-07 午前11 25 11
naota7118 commented 1 month ago

タイムアウトとリトライ回数を設定。

@drive = Google::Apis::DriveV3::DriveService.new.tap do |client|
  client.request_options.timeout_sec = 1200
  client.request_options.open_timeout_sec = 1200
  client.request_options.retries = 3
end

Google::Apis::RequestOptionsのインスタンスにtimeout_secというメソッドはないと言われる。

スクリーンショット 2024-08-07 午前11 42 31
naota7118 commented 1 month ago
@drive = Google::Apis::DriveV3::DriveService.new.tap do |client|
  client.client_options.open_timeout_sec = 120
  client.client_options.read_timeout_sec = 120
  client.request_options.retries = 3
end

タイムアウト秒数を設定するメソッドとリトライ回数を設定するメソッドのクラスが別だった。

タイムアウト秒数はClass: Google::Apis::ClientOptions https://googleapis.dev/ruby/google-api-client/v0.20.0/Google/Apis/ClientOptions.html

リトライ回数はClass: Google::Apis::RequestOptions https://googleapis.dev/ruby/google-api-client/v0.28.2/Google/Apis/RequestOptions.html