Replies: 2 comments 2 replies
-
Now that I read this, I agree. The way I've generally dealt with job errors in the past (and the way I do it with PDF generator) is to have a page users can go to where they can see the status. In this case, I would think we'd put a link somewhere on the observation page that shows up when associated images are "processing" or in the "error" state. They can click on the link to get more details. We cannot assume that users will keep a web page open to MO after they do their upload. This would also address the API (read Mobile) case. |
Beta Was this translation helpful? Give feedback.
-
Thanks. Ok, i'll see if i can make progress on it. (On the separate Vips question - in case you're curious to read about it, this is a Rails discussion leading up to switching their default from ImageMagick.) |
Beta Was this translation helpful? Give feedback.
-
The question here is whether it's desirable to offload image upload processing to a Solid Queue job.
When images are uploaded to MO (say for Create Obs), they go through a second step where they are "processed". They get resized to several smaller dimensions, and then everything gets uploaded to the image server.
This "process" happens synchronously. The server is doing that until it's done.
By making it a "Job", the server can do it when it's not busy, and adjust for its own resource budget. This seems like it would be a performance improvement for the server overall. Jason seems to feel that it's probably "the right way to do it". He raised some good points though:
It would mean that we have to handle errors a bit differently in both the UI and the API, because jobs do not return info. They can handle errors, but they do not return messages. The errors have to result in some other Ruby action: a database update, an email, etc.
I spoke with Jason about a pattern proposed by AI. According to this, we'd add an
upload_status
column toImage
, and set it to something likepending
when the process starts. On success it would be set tosuccess
; on error it would be set to the error message.Currently in "Create Obs" we don't handle error reporting in the UI. If someone does something like rename a ".pages" file as a ".jpg" and tries to upload it as an image, the UI just seems to hang. The console shows a 500 error, but the front end user doesn't receive it on the page. That could definitely be improved.
The main difference with doing it as a Job is we'd need to use something like websockets to "broadcast" any image processing errors to the user — maybe in their
flash_messages
div, or maybe in a notifications inbox — or send them an email. The UI wouldn't be waiting for the images to process, and the user would be free to go on and do other things, so we'd need to build a way to get them error messages.With the API, the consideration is similar, but we can't use websockets. The client would need to poll the
image.upload_status
to find out if the upload worked, or we'd need to email them.Beta Was this translation helpful? Give feedback.
All reactions