I am using active_storage
to store and retrieve three plots on a web page on Heroku
. The code to retrieve the plot is
image_tag plot.variant(resize: '500x500'), class: 'r_plot'
Each plot is fairly small, around 500 KByte. I frequently see the following error from the Logentries heroku add-on:
High Response Time: Heroku/Syslog drain
2020-05-30 21:39:37.733
671 <158>1 2020-05-30T21:39:35.184905+00:00 heroku router - - at=info method=GET path="/rails/active_storage/representations/long_token/-tmp-plotsPlotname" host=cvd-tracker.herokuapp.com request_id=some_id fwd="ip_address" dyno=web.1 connect=0ms service=5015ms status=302 bytes=1679 protocol=https
Why is it taking so long to retrieve these plots?
Could be a few things:
Does it sound like any of these apply to your situation?
EDIT - Background Processing:
It appears that the actual processing is triggered when processed is called so you could do something like this in your rake task:
upload = Upload.find(upload_id)
variant = upload.image.variant(options)
was_processed = variant.processed
Rails.logger.info "Processed variant for #{upload.id}" if was_processed
I found the above along with some other tips here.