Skip to content

Instantly share code, notes, and snippets.

@clayg
Created July 20, 2015 23:14
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 clayg/b36f6196156999f1671c to your computer and use it in GitHub Desktop.
Save clayg/b36f6196156999f1671c to your computer and use it in GitHub Desktop.
diff --git a/swift/obj/server.py b/swift/obj/server.py
index 94088df..07b6363 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=None):
"""
Sends or saves an async update.
@@ -217,6 +218,8 @@ class ObjectController(BaseStorageServer):
:param objdevice: device name that the object is in
:param policy: the associated BaseStoragePolicy instance
"""
+ if logger_thread_locals:
+ self.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 +295,8 @@ 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,
+ logger_thread_locals=self.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
@@ -382,7 +386,7 @@ class ObjectController(BaseStorageServer):
op, self.expiring_objects_account, delete_at_container,
'%s-%s/%s/%s' % (delete_at, account, container, obj),
host, partition, contdevice, headers_out, objdevice,
- policy)
+ policy, logger_thread_locals=self.logger.thread_locals)
def _make_timeout_reader(self, file_like):
def timeout_reader():
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment