Skip to content

Commit f415427

Browse files
authored
Merge pull request #16 from frizzby/batch_size
Make async log batch size configurable with rp_log_batch_size option
2 parents 4cd2349 + 848800d commit f415427

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(
136135
endpoint, project, token, api_base)
137136
self.log_batch = []
@@ -182,7 +181,7 @@ def process_log(self, **log_item):
182181
"""
183182
logger.debug("Processing log item: %s", log_item)
184183
self.log_batch.append(log_item)
185-
if len(self.log_batch) >= self.BATCH_SIZE:
184+
if len(self.log_batch) >= self.log_batch_size:
186185
self._post_log_batch()
187186

188187
def process_item(self, item):

0 commit comments

Comments
 (0)