appoxy / aws

Amazon Web Services (AWS) Ruby Gem
https://rubygems.org/gems/aws
236 stars 87 forks source link

Server queue.amazonaws.com closed connection #108

Closed sidbatra closed 12 years ago

sidbatra commented 12 years ago

Creating an Aws::Sqs object with the :connection_mode => :single is supposed to open a persistent connection to queue.amazonaws.com.

However, after a period of inactivity ( ~2 minutes) when a new message is pushed onto the queue the following message is seen:

Rightscale::HttpConnection : server queue.amazonaws.com closed connection
Opening new HTTPS connection to queue.amazonaws.com:443

This slows down pushing that message by ~500ms. Is there any way to fix this?

thanks!

treeder commented 12 years ago

Don't leave your connection idle. I believe SQS closes connections after 60 seconds.

sidbatra commented 12 years ago

thanks for replying.

I'm using it in my Rails observers and any delay > 100ms is costly. Sending a message onto the queue at regular intervals is a bit hacky.

Any scope of an inbuilt feature that polls queue.amazonaws.com every 60 secs?

treeder commented 12 years ago

Not something planned, but feel free to add something and send me a pull request.

treeder commented 12 years ago

Hi @sidbatra , did you figure out a solution for this?

sidbatra commented 12 years ago

Hey @treeder, I gave up after a bit of trying. The problem only happens at a low write frequency so I'm ok with it for now. I narrowed it down to manual sleep commands in right_http_connection.rb

I'll reply if I have any more luck.