Skip to content

Commit f164f86

Browse files
author
frizzby
committed
Make async log batch size configurable with
rp_log_batch_size option
1 parent 3c4bdd9 commit f164f86

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

reportportal_client/service_async.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,8 @@ class ReportPortalServiceAsync(object):
116116
"""Wrapper around service class to transparently provide async operations
117117
to agents."""
118118

119-
BATCH_SIZE = 20
120-
121119
def __init__(self, endpoint, project, token, api_base="api/v1",
122-
error_handler=None):
120+
error_handler=None, log_batch_size=20):
123121
"""Init the service class.
124122
125123
Args:
@@ -132,6 +130,7 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
132130
"""
133131
super(ReportPortalServiceAsync, self).__init__()
134132
self.error_handler = error_handler
133+
self.log_batch_size = log_batch_size
135134
self.rp_client = ReportPortalService(endpoint, project, token, api_base)
136135
self.log_batch = []
137136
self.supported_methods = ["start_launch", "finish_launch",
@@ -181,7 +180,7 @@ def process_log(self, **log_item):
181180
"""
182181
logger.debug("Processing log item: %s", log_item)
183182
self.log_batch.append(log_item)
184-
if len(self.log_batch) >= self.BATCH_SIZE:
183+
if len(self.log_batch) >= self.log_batch_size:
185184
self._post_log_batch()
186185

187186
def process_item(self, item):

0 commit comments

Comments
 (0)