GAE still serving image from google cloud storage after calling delete_serving_url and deleting file
Asked Answered
C

1

7

Current procedure to serve image is as follows:

  1. Store image on google cloud storage
  2. Get blob_key: google.appengine.ext.blobstore.create_gs_key(filename)
  3. Get url: google.appengine.api.images.get_serving_url(blob_key,size=250,secure_url=True)

To remove the image, after retrieving the blob_key:

  1. Delete serving url: google.appengine.api.images.delete_serving_url(blob_key)
  2. Delete google cloud storage file: 'cloudstorage.delete(filename)'

Issue

The issue is that the url is still serving for an undefined amount of time, even though the underlying image does not exist on google cloud storage anymore. Most of the time the url returns 404 in ~24hrs, but have also seen 1 image still serving now (~2wks).

What are the expectations about the promptness of the delete_serving_url call? Any alternatives to delete the url faster?

Caryopsis answered 29/6, 2014 at 23:48 Comment(5)
Did you set the Cache-Control header on the object?Restive
I am using the GCS Client Library function (gcs.open) to create the object link, but could not specify the Cache-Control. Does it support it?Caryopsis
Mistake on my end, was using option as x-goog-cache-control, whereas it needed cache-control. Nevertheless, when creating the file using cloudstorage.open(filename, 'w',content_type=mimetype,options={'cache-control':'no-cache'}), and then going through the procedure described above the url still works after 1hr. Thoughts?Caryopsis
please vote for this: code.google.com/p/googleappengine/issues/detail?id=11381Dubois
Does anybody know a workaround ? Please share.Lockjaw
R
0

I can address one of your two questions. Unfortunately, it's the less helpful one. :/

What are the expectations about the promptness of the delete_serving_url call?

Looking at the Java documentation for getServingUrl, they clearly spell out to expect it to take 24 hours, as you observed. I'm not sure why the Python documentation leaves this point out.

If you wish to stop serving the URL, delete the underlying blob key. This takes up to 24 hours to take effect.

The documentation doesn't explain why one of your images would still be serving after 2 weeks.

It is also interesting to note that they don't reference deleteServingUrl as part of the process to stop serving a blob. That suggests to me that step (1) in your process to "delete the image" is unnecessary.

Rattigan answered 25/7, 2015 at 11:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.