Idea: asynchronously load images from GCS
Open, LowPublic

Description

This is just an idea. Logging in to the cloud is slow, and I think that's partially because of the images on the activity stream. Other not-so-often visited pages with many images (such as some texture groups) are also very slow to load. I was thinking, maybe it's a good idea to not refresh the URL at GCS when the HTML loads. Instead, we use a placeholder image for all images with expired links, and put the file ObjectID into a data attribute. Then some JavaScript can asynchronously fetch all those from our server from a special end-point that'll refresh the URLs.

Of course we'll have to think about the security implications for this. Maybe using the file ObjectID is a bad idea, because it's too easy to guess other IDs. A special endpoint serving files by ObjectID will allow a user to simply increment the ObjectIDs until files from someone else's project are returned.

Still, I think it's worth thinking about, as it may give a significant (perceived) speedup of the cloud.

Details

Type
Design

Would be great to somehow retrieve or the height/width of the file so the placeholders don't break the layout. In most cases we know the size of thumbnails (group view, frontpage), but when the images are responsive we don't.

The sizes are stored in the file document, which needs to be accessed anyway to figure out whether links are outdated or not. I'm sure we can get those values into the Jinja template context.

Sybren A. Stüvel (sybren) lowered the priority of this task from Normal to Low.Jan 26 2018, 4:43 PM

Changing to low prio since we have a Celery task that actively refreshes expired links.