From 1b243ad37d0473a458461ab0a805767c91bf4d94 Mon Sep 17 00:00:00 2001 From: njupthan Date: Mon, 14 Mar 2022 16:47:14 +0000 Subject: [PATCH 1/2] Modify the number of notifications sent per second Signed-off-by: njupthan --- frameworks/ans/core/common/include/ans_const_define.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/ans/core/common/include/ans_const_define.h b/frameworks/ans/core/common/include/ans_const_define.h index 9d842d285..fccaf1925 100644 --- a/frameworks/ans/core/common/include/ans_const_define.h +++ b/frameworks/ans/core/common/include/ans_const_define.h @@ -27,7 +27,7 @@ namespace Notification { // Max active notification number constexpr uint32_t MAX_ACTIVE_NUM = 1000; constexpr uint32_t MAX_ACTIVE_NUM_PERAPP = 100; -constexpr uint32_t MAX_ACTIVE_NUM_PERSECOND = 10; +constexpr uint32_t MAX_ACTIVE_NUM_PERSECOND = 3; constexpr uint32_t MAX_SLOT_NUM = 5; constexpr uint32_t MAX_SLOT_GROUP_NUM = 4; constexpr uint32_t MAX_ICON_SIZE = 50 * 1024; -- Gitee From 34789c82644fbd01fa7022df49c3a84bd189783e Mon Sep 17 00:00:00 2001 From: njupthan Date: Mon, 14 Mar 2022 19:49:40 +0800 Subject: [PATCH 2/2] Add log Signed-off-by: njupthan --- services/ans/src/advanced_notification_service.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 01efae947..123747c68 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -1961,6 +1961,15 @@ ErrCode AdvancedNotificationService::FlowControl(const std::shared_ptr= MAX_ACTIVE_NUM_PERSECOND) { + std::stringstream stream; + auto timeT = std::chrono::system_clock::to_time_t(*flowControlTimestampList_.begin()); + stream << std::put_time(std::localtime(&timeT), "%H:%M:%S."); + auto msT = std::chrono::duration_cast( + (*flowControlTimestampList_.begin()).time_since_epoch()); + + stream << msT.count() % 1000; + + ANS_LOGD("id:%{public}d start time:%{public}s", record->request->GetNotificationId(), stream.str().c_str()); return ERR_ANS_OVER_MAX_ACITVE_PERSECOND; } -- Gitee