mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-30 01:04:05 +08:00
Limit max async queue size to 250,000 entries
This commit is contained in:
parent
af8440b248
commit
eb660caa6c
@ -66,10 +66,6 @@ int main(int argc, char *argv[]) {
|
|||||||
if (argc > 2) threads = atoi(argv[2]);
|
if (argc > 2) threads = atoi(argv[2]);
|
||||||
if (argc > 3) {
|
if (argc > 3) {
|
||||||
queue_size = atoi(argv[3]);
|
queue_size = atoi(argv[3]);
|
||||||
if (queue_size > 500000) {
|
|
||||||
spdlog::error("Max queue size allowed: 500,000");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 4) iters = atoi(argv[4]);
|
if (argc > 4) iters = atoi(argv[4]);
|
||||||
@ -79,6 +75,13 @@ int main(int argc, char *argv[]) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr int max_q_size = sinks::async_sink::max_queue_size;
|
||||||
|
if(queue_size > max_q_size)
|
||||||
|
{
|
||||||
|
spdlog::error("Queue size too large. Max queue size is {:L}", max_q_size);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
auto slot_size = sizeof(details::async_log_msg);
|
auto slot_size = sizeof(details::async_log_msg);
|
||||||
spdlog::info("-------------------------------------------------");
|
spdlog::info("-------------------------------------------------");
|
||||||
spdlog::info("Messages : {:L}", howmany);
|
spdlog::info("Messages : {:L}", howmany);
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
discard_new // Discard the log message if the queue is full
|
discard_new // Discard the log message if the queue is full
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { default_queue_size = 8192, max_queue_size = 10 * 1024 * 1024 };
|
enum { default_queue_size = 8192, max_queue_size = 250'000};
|
||||||
|
|
||||||
struct config {
|
struct config {
|
||||||
size_t queue_size = default_queue_size;
|
size_t queue_size = default_queue_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user