Skip to content

Commit 8a5a917

Browse files
committed
fix: added log count not reset in interval
1 parent 9246958 commit 8a5a917

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/vlogs_handler/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
from .handler import VictoriaLogsHandler # noqa: F401
44

55
__title__ = "VictoriaLogs Handler"
6-
__version__ = "0.1.0dev5"
6+
__version__ = "0.1.0dev6"
7+
8+
# TODO
9+
# [ ] - Split very large requests
10+
# [ ] - Consider using a persistent queue

src/vlogs_handler/handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def emit(self, record: logging.LogRecord) -> None:
166166
with self._lock:
167167
self._added_count += 1
168168
if self._added_count > self._batch_size:
169-
self._added_count = 0
170169
self._worker_run.set()
171170

172171
def _format_log_record(self, record: logging.LogRecord) -> Dict[str, Any]:
@@ -209,6 +208,8 @@ def start(self):
209208
def _worker(self):
210209
while not self._worker_shutdown.is_set():
211210
self._worker_run.wait(timeout=self._flush_interval)
211+
with self._lock:
212+
self._added_count = 0
212213
self.flush()
213214
self._worker_run.clear()
214215

0 commit comments

Comments
 (0)