design patterns - Processing attachments with Heroku and Mailgun Routes -
my webapp ruby on rails application deployed heroku.
i use mailgun routes forward email web application. documentation mailgun routes here http://documentation.mailgun.net/user_manual.html#um-routes.
basically mailgun routes posts stuff subject, body, senders etc http parameters. attachments posted file uploads encoded in multipart/form-data. in controller, show uploadedfile (http://api.rubyonrails.org/classes/actiondispatch/http/uploadedfile.html).
in controller, proceed upload attachment(s) s3.
however if there large attachments or many attachments, request time out (heroku's infamous h12 error).
i tried using background worker (delayed job) ran these issues
- sending entire uploadedfile object or uploadedfile.tempfile background worker leads unreliable behavior (delayed job doesn't play nice large objects such model instances)
- sending path tempfile , trying open doesn't work since tempfiles accessible dyno on (tempfile stored in web worker dyno , access tried background worker dyno fails - creating temporary files in heroku)
any clever ideas on how can fix this?
i've come across similar problems using mailgun's routes feature. answer problem seems to use 'store' feature released later in 2013. wish i'd come across before integrating routes feature, approach using store quite different.
Comments
Post a Comment