Skip to content

Commit 2d7980b

Browse files
committed
Remove redundant lock
1 parent 2ff8214 commit 2d7980b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

reportportal_client/core/log_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ def __init__(self, rp_url, session, api_version, launch_id, project_name,
5353
:param max_payload_size: maximum size in bytes of logs that can be
5454
processed in one batch
5555
"""
56-
self._stop_lock = Lock()
57-
self._size_lock = Lock()
56+
self._lock = Lock()
5857
self._batch = []
5958
self._payload_size = helpers.TYPICAL_MULTIPART_FOOTER_LENGTH
6059
self._worker = None
@@ -89,7 +88,7 @@ def _log_process(self, log_req):
8988
9089
:param log_req: RPRequestLog object
9190
"""
92-
with self._size_lock:
91+
with self._lock:
9392
rq_size = log_req.multipart_size
9493
if self._payload_size + rq_size >= self.max_payload_size:
9594
if len(self._batch) > 0:
@@ -127,7 +126,7 @@ def start(self):
127126
def stop(self):
128127
"""Send last batches to the worker followed by the stop command."""
129128
if self._worker:
130-
with self._stop_lock:
129+
with self._lock:
131130
if self._batch:
132131
self._send_batch()
133132
logger.debug('Waiting for worker {0} to complete'

reportportal_client/core/log_manager.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ MAX_LOG_BATCH_PAYLOAD_SIZE: int
2929

3030

3131
class LogManager:
32-
_stop_lock: Lock = ...
33-
_size_lock: Lock = ...
32+
_lock: Lock = ...
3433
_log_endpoint: Text = ...
3534
_batch: List = ...
3635
_payload_size: int = ...

0 commit comments

Comments
 (0)