launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25168
[Merge] ~twom/launchpad:revert-897463a14e165e8e46d2b65f6cfad6dc02bf7fd4 into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:revert-897463a14e165e8e46d2b65f6cfad6dc02bf7fd4 into launchpad:master.
Commit message:
Revert "Avoiding race condition at librarian client test"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/389320
Causing OOPS in threading scenarios
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:revert-897463a14e165e8e46d2b65f6cfad6dc02bf7fd4 into launchpad:master.
diff --git a/lib/lp/services/librarian/client.py b/lib/lp/services/librarian/client.py
index ba18805..737d9e4 100644
--- a/lib/lp/services/librarian/client.py
+++ b/lib/lp/services/librarian/client.py
@@ -88,7 +88,6 @@ class FileUploadClient:
# 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 +115,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(0)
if poll_result:
fileno, event = poll_result[0]
# Accepts any event that contains input data. Even if we
diff --git a/lib/lp/services/librarian/tests/test_client.py b/lib/lp/services/librarian/tests/test_client.py
index 3b406c1..e00a86e 100644
--- a/lib/lp/services/librarian/tests/test_client.py
+++ b/lib/lp/services/librarian/tests/test_client.py
@@ -252,16 +252,6 @@ class LibrarianClientTestCase(TestCase):
'librarian', upload_host=upload_host, upload_port=upload_port)
client = LibrarianClient()
- # Artificially increases timeout to avoid race condition.
- # The fake server is running in another thread, and we are sure it
- # will (eventually) reply with an error message. So, let's just wait
- # until that message arrives.
- client.state.s_poll_timeout = 120
-
- # Please, note the mismatch between file size (7) and its actual size
- # of the content (6). This is intentional, to make sure we are raising
- # the error coming from the fake server (and not the local check
- # right after, while uploading the file).
self.assertRaisesRegex(
UploadFailed, 'Server said early: STORE 7 sample.txt',
client.addFile, 'sample.txt', 7, StringIO('sample'), 'text/plain')