Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfs_middleware: Delay clearing container info #377

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions pfs_middleware/pfs_middleware/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,13 +1239,13 @@ def put_container(self, ctx):
head_response)
except utils.RpcError as err:
if err.errno == pfs_errno.NotFoundError:
clear_info_cache(None, ctx.req.environ, ctx.account_name,
container=ctx.container_name)
self.rpc_call(ctx, rpc.put_container_request(
container_path,
"",
serialize_metadata({
k: v for k, v in new_metadata.items() if v})))
clear_info_cache(None, ctx.req.environ, ctx.account_name,
container=ctx.container_name)
return swob.HTTPCreated(request=req)
else:
raise
Expand All @@ -1255,10 +1255,10 @@ def put_container(self, ctx):
old_metadata, new_metadata)
raw_merged_metadata = serialize_metadata(merged_metadata)

clear_info_cache(None, ctx.req.environ, ctx.account_name,
container=ctx.container_name)
self.rpc_call(ctx, rpc.put_container_request(
container_path, raw_old_metadata, raw_merged_metadata))
clear_info_cache(None, ctx.req.environ, ctx.account_name,
container=ctx.container_name)

return swob.HTTPAccepted(request=req)

Expand Down Expand Up @@ -1299,19 +1299,20 @@ def post_container(self, ctx):
req.headers.clear()
req.headers.update(new_metadata)

clear_info_cache(None, req.environ, ctx.account_name,
container=ctx.container_name)
self.rpc_call(ctx, rpc.post_request(
container_path, raw_old_metadata, raw_merged_metadata))
clear_info_cache(None, req.environ, ctx.account_name,
container=ctx.container_name)

return swob.HTTPNoContent(request=req)

def delete_container(self, ctx):
# Turns out these are the same RPC with the same error handling, so
# why not?
response = self.delete_object(ctx)
clear_info_cache(None, ctx.req.environ, ctx.account_name,
container=ctx.container_name)
return self.delete_object(ctx)
return response

def _get_listing_limit(self, req, default_limit):
raw_limit = req.params.get('limit')
Expand Down