flask-s3 icon indicating copy to clipboard operation
flask-s3 copied to clipboard

Optimization

Open klinkin opened this issue 11 years ago • 6 comments

If bucket already exist and contains thousands static files https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L188

bucket.make_public(recursive=True)

it's very bad idea...

klinkin avatar Jan 23 '14 15:01 klinkin

Hmmm, a good point.

I don't have a lot of time right now but I guess a solution could involves using get_all_buckets() and checking for the bucket in question. Details here

e-dard avatar Jan 23 '14 15:01 e-dard

i'm working on it just now.

klinkin avatar Jan 27 '14 12:01 klinkin

I'm not entirely sure that simply changing recursive=False as suggested in the PR will do the trick. If a bucket already exists, it is likely that you'd want to make the entire thing public. @e-dard, if we checked get_all_buckets(), would be not make it public recursively? Whatever we do, there should be something added to the documentation to explain that a user needs to make the existing stuff public.

I'm also not entirely sure why that section is in that try/except block. @e-dard maybe you can enlighten my, but effectively we are now ignoring all but 1 specific error. That's probably a bad idea, and if we are just going to raise that error anyways, why not remove the try/except entirely?

eriktaubeneck avatar Jan 30 '14 22:01 eriktaubeneck

  1. Recursive mode 1.1 If we creat new bucket then it's empty and there is no need to do make_public in recursive mode. 1.2 If target bucket already exists then with high probability it’s already public. And all static files makes public when it copied, see https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L113
  2. Try/except block In master branch is the same implementation. See https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L186

klinkin avatar Jan 30 '14 22:01 klinkin

  1. It could be the case that there are files in S3 that aren't copied, but this is an edge case. I still think we should document it. 
  2. Yes, but your change brought it to my attention. ;) Sent from my Nintendo 64

On Thu, Jan 30, 2014 at 5:57 PM, Mike [email protected] wrote:

  1. Recursive mode 1.1 If we creat new bucket then it's empty and there is no need to do make_public in recursive mode. 1.2 If target bucket already exists then with high probability it’s already public. And all static files makes public when it copied, see https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L113
  2. Try/except block In master branch is the same implementation. See https://github.com/e-dard/flask-s3/blob/master/flask_s3.py#L186

    Reply to this email directly or view it on GitHub: https://github.com/e-dard/flask-s3/issues/16#issuecomment-33744126

eriktaubeneck avatar Jan 30 '14 23:01 eriktaubeneck

Yeah, oops on the try block :blush:

e-dard avatar Feb 09 '14 15:02 e-dard