Browse Source

clear cache when put bucket

Signed-off-by: changlin.shi <changlin.shi@ly.com>
pull/4090/head
changlin.shi 2 years ago
parent
commit
d2792c5618
  1. 5
      weed/s3api/bucket_metadata.go
  2. 4
      weed/s3api/s3api_bucket_handlers.go

5
weed/s3api/bucket_metadata.go

@ -232,3 +232,8 @@ func (r *BucketRegistry) unMarkNotFound(bucket string) {
defer r.notFoundLock.Unlock()
delete(r.notFound, bucket)
}
func (r *BucketRegistry) ClearCache(bucket string) {
r.removeMetadataCache(bucket)
r.unMarkNotFound(bucket)
}

4
weed/s3api/s3api_bucket_handlers.go

@ -153,6 +153,10 @@ func (s3a *S3ApiServer) PutBucketHandler(w http.ResponseWriter, r *http.Request)
s3err.WriteErrorResponse(w, r, s3err.ErrInternalError)
return
}
// clear cache
s3a.bucketRegistry.ClearCache(bucket)
w.Header().Set("Location", "/"+bucket)
writeSuccessResponseEmpty(w, r)
}

Loading…
Cancel
Save