summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2024-01-25 10:20:09 +0800
committerliuxueli <[email protected]>2024-01-25 10:20:09 +0800
commit82ce053f67b78b03d89641a2ee53b7825c2b2fa9 (patch)
tree4ec0b9d7a45710fb0ce37956cad938b4eefda897
parentf52734b5cecd356576c78e0a3a62cebe60af8efd (diff)
Bugfix: rapidjson序列化时导致单核CPU使用率100%
-rw-r--r--.gitignore2
-rw-r--r--src/tsg_send_log.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index c1b56f2..d8a3237 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
SI/*
.vscode/*
-build/
+build*/
cmake-build-*
*.si4project
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index bac824d..62bb7e2 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -1186,7 +1186,7 @@ struct TLD_handle_t *TLD_create(int thread_id)
int TLD_convert_json(struct TLD_handle_t *_handle, char *buff, unsigned int buff_len)
{
- StringBuffer sb(0, 2048);
+ StringBuffer sb(0, g_tsg_log_instance->rapidjson_chunk_capacity);
Writer<StringBuffer> writer(sb);
_handle->document->Accept(writer);
@@ -2192,7 +2192,7 @@ int send_log_by_type(struct tsg_log_instance_t *_instance, struct TLD_handle_t *
);
}
- StringBuffer sb(0, 2048);
+ StringBuffer sb(0, _instance->rapidjson_chunk_capacity);
Writer<StringBuffer> writer(sb);
_handle->document->Accept(writer);