Limit error log from __get_connection 86/236586/4
authorchangyu-choi <changyu.choi@samsung.com>
Thu, 18 Jun 2020 08:16:37 +0000 (17:16 +0900)
committerchangyu-choi <changyu.choi@samsung.com>
Thu, 18 Jun 2020 08:41:33 +0000 (17:41 +0900)
Change-Id: I29bbbe56296a2ede7a8cb7f0422d9318ccf7b917
Signed-off-by: changyu-choi <changyu.choi@samsung.com>
src/launchpad/src/launchpad_dbus.c

index f1446f1..171612b 100644 (file)
@@ -29,6 +29,8 @@
 
 #define PENDING_ITEM_INTERVAL           1000
 
+#define GET_CONNECTION_ERROR_THRESHOLD  10
+#define GET_CONNECTION_ERROR_MODULO     1000
 typedef enum {
        APP_SIGNAL_DEAD,
        APP_SIGNAL_LAUNCH,
@@ -83,14 +85,20 @@ static pending_item_t *__create_pending_item(const char *app_id,
 static GDBusConnection *__get_connection(void)
 {
        GError *error = NULL;
+       static unsigned int error_count = 0;
 
        if (__conn)
                return __conn;
 
        __conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
        if (!__conn) {
-               _E("g_bus_get_sync() is failed. error(%s)",
+               error_count++;
+               if (error_count < GET_CONNECTION_ERROR_THRESHOLD ||
+                               error_count % GET_CONNECTION_ERROR_MODULO == 0) {
+                       _E("g_bus_get_sync() is failed. error(%s)",
                                error ? error->message : "Unknown");
+               }
+
                g_clear_error(&error);
                return NULL;
        }