← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:librarian-client-where-has-all-the-state-gone into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:librarian-client-where-has-all-the-state-gone into launchpad:master.

Commit message:
Use class variable rather than thread local state for timeout that isn't state

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/389319
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:librarian-client-where-has-all-the-state-gone into launchpad:master.
diff --git a/lib/lp/services/librarian/client.py b/lib/lp/services/librarian/client.py
index ba18805..219d80d 100644
--- a/lib/lp/services/librarian/client.py
+++ b/lib/lp/services/librarian/client.py
@@ -83,12 +83,13 @@ def compose_url(base_url, alias_path):
 class FileUploadClient:
     """Simple blocking client for uploading to the librarian."""
 
+    s_poll_timeout = 0
+
     def __init__(self):
         # This class is registered as a utility, which means an instance of
         # it will be shared between threads. The easiest way of making this
         # class thread safe is by storing all state in a thread local.
         self.state = threading.local()
-        self.state.s_poll_timeout = 0
 
     def _connect(self):
         """Connect this client.
@@ -116,7 +117,7 @@ class FileUploadClient:
         del self.state.f
 
     def _checkError(self):
-        poll_result = self.state.s_poll.poll(self.state.s_poll_timeout)
+        poll_result = self.state.s_poll.poll(self.s_poll_timeout)
         if poll_result:
             fileno, event = poll_result[0]
             # Accepts any event that contains input data. Even if we