S3上的回形针处理器超时

我正在将数字签名插入到处理器内的pdf文件中,但不断收到AWS::S3::ERRORS::Requestimeout错误。 什么是超时? 有没有什么办法可以保持连接打开,直到文件上传?

未在超时期限内读取或写入与服务器的套接字连接。 空闲连接将被关闭。

这是我的代码:

模型:

 ... has_attached_file :receipt_file, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename", :s3_protocol => "https", :styles => {dummy:""}, processors: [:SignPdf] #process_in_background :receipt_file ... 

处理器

 module Paperclip class SignPdf < Processor attr_accessor :receipt_id,:style S3_CONFIG = YAML.load_file("#{::Rails.root}/config/s3.yml")[Rails.env] ORIGAMIDIR = "/ruby/1.9.1/gems/origami-1.2.4/lib" def initialize(file, options = {}, attachment = nil) @file = file @current_format = File.extname(@file.path) @basename = File.basename(@file.path, @current_format) @attachment = attachment end def make signPdf(@file) @file end end end begin require 'origami' rescue LoadError $: < 89.0, :lly => 386.0, :urx => 190.0, :ury => 353.0] page.add_annot(sigannot) # Sign the PDF with the specified keys pdf.sign(cert, key, :method => 'adbe.pkcs7.sha1', :annotation => sigannot, :location => "Portugal", :contact => "email@email.pt", :reason => "Proof of Concept" ) # Save the resulting file pdf.save(file.path) file end 

我通过使用后保存解决了这个问题。 请在此处查看与此主题相关的答案

您正在寻找的内容不在今天的文档中。 您需要创建AWS :: S3 :: Client

我正在引用: https : //github.com/thoughtbot/paperclip/blob/master/lib/paperclip/storage/s3.rb#L263

  config.paperclip_defaults = { storage: :s3, s3_credentials: "#{Rails.root}/config/s3.yml", s3_region: ENV['AWS_REGION'], s3_protocol: :https, s3_options: { client: Aws::S3::Client.new( access_key_id: ENV['S3_KEY'], secret_access_key: ENV['S3_SECRET'], http_open_timeout: 10, http_read_timeout: 5, http_idle_timeout: 20 ) } }