ruby rest-client: make it never timeout?

后端 未结 6 1267
温柔的废话
温柔的废话 2021-02-12 21:34

I am trying to use ruby rest-client to upload a large number of images to a site that I\'m writing. My code looks like:

RestClient.post url, :timeout => 9000         


        
6条回答
  •  日久生厌
    2021-02-12 22:15

    Looking at the docs, you can pass -1 through RestClient.execute timeout param:

    # * :timeout and :open_timeout passing in -1 will disable the timeout by setting the corresponding net timeout values to nil
    

    It can be used as follows:

    resource = RestClient::Resource.new(
      "url",
      :timeout => -1,
      :open_timeout => -1
    response = resource.get :params => {}
    

提交回复
热议问题