orthecreedence/drakma-async

Smarter read-timeout

orthecreedence opened this issue · 0 comments

When sending large chunks of data, (say, a 5MB file part to S3) the connection sometimes times out while uploading because the :read-timeout is hit.

It makes a lot of sense to disable the read timeout when sending data and re-enable it when data has been fully sent.

Investigate tcp-connect's :write-cb callback, determine if it gets called when ALL data is flushed to the socket from the bufferevent (good) or if it gets called in chunks (more difficult). This can be used to say "start upload, disable read timeout until :write-cb is triggered." Or if we're chunking, we can re-enable the read-timeout on the :write-cb of the last chunk.