0

我们构建了一个网络应用程序,它可以根据用户定义的业务规则自动索引电子邮件附件并将其直接保存到 Google Drive。我们在同步某些 Google Drive 帐户时看到失败,并且无法找出问题所在。

这是错误:

列出文件错误:后端错误 /mnt/opt/openera/current/app/models/cloud_account/google_drive.rb:299:in 'list_files' /mnt/opt/openera/current/app/models/cloud_account/google_drive.rb: 220:在“do_discover_files”/mnt/opt/openera/current/app/models/cloud_account/base.rb:304:在“发现文件”/mnt/opt/openera/current/app/workers/worker/file_synchronizer.rb: 10:在'执行'/mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:45:在'块(3级)进行中' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:109:in '调用' /mnt/opt /openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:109:in 'block in voke'/mnt/opt/openera/current/lib/sidekiq_repeat_jobs/middleware/server/repeat_jobs.rb:36:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq- 2.6.5/lib/sidekiq/middleware/chain.rb:111:in 'block in voke' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/ lib/sidekiq/middleware/server/timeout.rb:14:in 'cal l' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/ middleware/chain.rb:111:in 'block in in voke' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/ active_record.rb:6:in '调用'/mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:111:in '在 voke 中阻止' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/retry_jobs.rb:49:in '调用' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq -2.6.5/lib/sidekiq/middleware/chain.rb:111:in 'block in in voke' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5 /lib/sidekiq/middleware/server/logging.rb:11:in 'block in call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib /sidekiq/logging.rb:22:in 'with_context' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/logging. rb:7:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:111:in 'block在调用'/mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6。5/lib/sidekiq/middleware/chain.rb:114:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware /chain.rb:114:in 'invoke' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:44:in '进程中的块(2个级别)' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:80:in 'stats' / mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:43:in 'block in process' /mnt/opt/openera/current /vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9. 1/gems/celluoid-0.12.4/lib/celluoid/calls.rb:23:in 'public_send'/mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in 'dispatch' /mnt/opt/openera/current/ vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/future.rb:18:in 'block in initiali ze' /mnt/opt/openera/current/vendor/bundle/ruby/ 1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluoid-0.12 .4/lib/celluloid/internal_pool.rb:48:in 'block in create'rb:48:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in 'block in c复习'rb:48:in 'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in 'block in c复习'

更新:这是我们高级开发人员的实际代码。

在此处开发 (ffoeg) 添加调用的实际代码:

def list_files
 pageToken = nil
 params = {'maxResults' => 65535, 'q' => 'trashed = false'}
 files = [] 
 drive = session.discovered_api("drive", "v2")
 while true do
   call_params = pageToken.blank? ? params : params.merge('pageToken' => pageToken)
   result = session.execute(api_method: drive.files.list, parameters: call_params)
   if result.status == 200
     files += result.data.items
     break if result.data['nextPageToken'].blank?
     pageToken = result.data['nextPageToken']
   else 
     raise "List Files Error: #{result.data['error']['message']}"
   end  
 end  
 files
end

再次更新:

我们更新了代码以获得确切的错误 - 这里是:

List Files Error: {"errors"=>[{"domain"=>"global", "reason"=>"backendError", 
"message"=>"Backend Error"}], "code"=>503, "message"=>"Backend Error"}
4

1 回答 1

0

问题是 maxResults 的值。它太大了,会导致请求超时。不幸的是,“安全”值非常小,每页大约 200 个结果。您可以更大,但结果会因用户而异。语料库较小的用户可能会在较大的页面尺寸下正常工作,但语料库较大的用户似乎更敏感。好吧,至少基于对我的一些帐户的一些非常快速/非正式的测试。

FWIW,我记得使用更大的页面尺寸会更好。将检查是否有任何可能超出预期的限制。

于 2013-02-04T18:11:14.543 回答