Fix svace issue(WGID 379871) 34/195934/1 accepted/tizen/unified/20181220.170031 submit/tizen/20181220.003510
authorsinikang <sinikang@samsung.com>
Wed, 19 Dec 2018 23:05:35 +0000 (08:05 +0900)
committersinikang <sinikang@samsung.com>
Wed, 19 Dec 2018 23:05:35 +0000 (08:05 +0900)
Change-Id: I92bdf8b6a31750599babdf0102df97cb113216f9

packaging/tel-plugin-database.spec
src/database_main.c

index 8f2bd59..113fa52 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 1
-%define patchlevel 45
+%define patchlevel 46
 
 Name:           tel-plugin-database
 Version:        %{major}.%{minor}.%{patchlevel}
index 9756a3d..4a23f7c 100644 (file)
 #define PLUGIN_VERSION 1
 #endif
 
+#define BUSY_WAITING_USEC 50000 /* 0.05 sec */
+#define BUSY_WAITING_MAX 20 /* wait for max 1 sec */
+
+
 static gboolean __update_query_database(Storage *strg, void *handle, const char *query, GHashTable *in_param)
 {
        int rv = 0;
@@ -95,14 +99,13 @@ static gboolean __update_query_database(Storage *strg, void *handle, const char
 
 static int _busy_handler(void *pData, int count)
 {
-       if (5 - count > 0) {
-               dbg("Busy Handler Called! : CNT(%d)\n", count + 1);
-               usleep((count + 1) * 100000);
+        if (count < BUSY_WAITING_MAX) {
+               usleep(BUSY_WAITING_USEC);
                return 1;
-       } else {
-               dbg("Busy Handler will be returned SQLITE_BUSY error\n");
-               return 0;
        }
+
+       dbg("Busy Handler will be returned SQLITE_BUSY error\n");
+       return 0;
 }
 
 static void *create_handle(Storage *strg, const char *path)