holmesal / shortwave

2 stars 0 forks source link

Move gfycat parse calls to the client. #160

Closed holmesal closed 10 years ago

holmesal commented 10 years ago

So we seem to be getting rate limited by gfycat when converting gifs. This is because we're piping everything through the server, instead of from each individual client. As a result, they see a ton of requests coming from a single IP. This only gets worse as we pull more users in.

So we need to move this to the client somehow.

We could probably coincide this with moving all of the responsibility for checking content-type off onto the client. So anytime someone sends a message that contains a link, we make a HEAD request from the client to determine the type of content, and then build and send the message.

This still is kinda tricky when hubot is involved. We could introduce an additional inReplyTo property on the user that holds the userId of the sender. Then, if a client recognizes that the message is a hubot reply to a message it posted, it could handle sending it to gfycat.

You'd see essentially what you see now, which would look like:

holmesal commented 10 years ago

Solution for now -

Revert GIF type messages to just contain links to GIFs, and clients are now responsible for using GFYCAT (or any other provider) to convert those links to MP4.

DogsForArms commented 10 years ago

Done on android and ios.