Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 9/29/2010: ActiveRecord finders strings vs ints; Paperclip and S3 timeouts

Ask for Help

“S3 is giving us 400 timeout responses on every first upload for a request. All subsequent uploads for the same request seem to work fine.”

This turned out to be a bug in the HEAD version of Paperclip. They added a fingerprint method that creates a MD5 hash out of the original file, but the method forgets to rewind the original file when done. So S3 times out while waiting for data, but then rewinds the file before trying again. So it does ultimately get uploaded, but it was leading to ~10 second delays in the middle of the request.

Interesting Things

  • Be careful when doing MyModel.find_by_column-that-is-a-string in ActiveRecord. If you pass it an integer it won’t do a type conversion and will pass it down to SQL as an unquoted integer. MySQL will then not use any indexes you have on that column. This is with Rails 2.3.x and MySQL 5.0.x

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *