Skip to content

Instantly share code, notes, and snippets.

@notmyname
Created July 20, 2015 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notmyname/4121933a86aa3477b2f6 to your computer and use it in GitHub Desktop.
Save notmyname/4121933a86aa3477b2f6 to your computer and use it in GitHub Desktop.
diff --git a/swift/obj/server.py b/swift/obj/server.py
index 54dffc5..b4301c5 100644
--- a/swift/obj/server.py
+++ b/swift/obj/server.py
@@ -201,7 +201,8 @@ class ObjectController(BaseStorageServer):
device, partition, account, container, obj, policy, **kwargs)
def async_update(self, op, account, container, obj, host, partition,
- contdevice, headers_out, objdevice, policy):
+ contdevice, headers_out, objdevice, policy,
+ logger_thread_locals):
"""
Sends or saves an async update.
@@ -216,7 +217,11 @@ class ObjectController(BaseStorageServer):
request
:param objdevice: device name that the object is in
:param policy: the associated BaseStoragePolicy instance
+ :param logger_thread_locals: The thread local values to be set on the
+ self.app.logger to retain transaction
+ logging information.
"""
+ self.app.logger.thread_locals = logger_thread_locals
headers_out['user-agent'] = 'object-server %s' % os.getpid()
full_path = '/%s/%s/%s' % (account, container, obj)
if all([host, partition, contdevice]):
@@ -292,7 +297,7 @@ class ObjectController(BaseStorageServer):
for conthost, contdevice in updates:
gt = spawn(self.async_update, op, account, container, obj,
conthost, contpartition, contdevice, headers_out,
- objdevice, policy)
+ objdevice, policy, self.app.logger.thread_locals)
update_greenthreads.append(gt)
# Wait a little bit to see if the container updates are successful.
# If we immediately return after firing off the greenthread above, then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment