diff --git a/src/webcfg.c b/src/webcfg.c index 083af289..a4de3a65 100644 --- a/src/webcfg.c +++ b/src/webcfg.c @@ -252,7 +252,7 @@ void *WebConfigMultipartTask(void *status) clock_gettime(CLOCK_REALTIME, &ts); retry_flag = get_doc_fail(); - WebcfgDebug("The retry flag value is %d\n", retry_flag); + WebcfgInfo("The retry flag value is %d\n", retry_flag); if ( retry_flag == 0) { @@ -291,7 +291,7 @@ void *WebConfigMultipartTask(void *status) } else if(retry_flag == 1 || maintenance_doc_sync == 1) { - WebcfgDebug("B4 sync_condition pthread_cond_timedwait\n"); + WebcfgInfo("B4 sync_condition pthread_cond_timedwait\n"); set_maintenanceSync(false); WebcfgInfo("reset maintenanceSync to false\n"); rv = pthread_cond_timedwait(&sync_condition, &sync_mutex, &ts); @@ -302,26 +302,7 @@ void *WebConfigMultipartTask(void *status) { rv = pthread_cond_wait(&sync_condition, &sync_mutex); } - - if(rv == ETIMEDOUT && !g_shutdown) - { - if(get_doc_fail() == 1) - { - set_doc_fail(0); - set_retry_timer(900); - set_global_retry_timestamp(0); - failedDocsRetry(); - WebcfgDebug("After the failedDocsRetry\n"); - } - else - { - time(&t); - wait_flag = 0; - maintenance_count = 0; - WebcfgDebug("Supplementary Sync Interval %d sec and syncing at %s\n",value,ctime(&t)); - } - } - else if(!rv && !g_shutdown) + if(!rv && !g_shutdown) { //webcfg_forcedsync_needed is set initially whenever force sync SET is detected internally & webcfg_forcedsync_started is set when actual sync is started once previous sync is completed. if(get_global_webcfg_forcedsync_needed()) @@ -367,6 +348,24 @@ void *WebConfigMultipartTask(void *status) WebcfgDebug("forced_sync is %d\n", forced_sync); } + else if(rv == ETIMEDOUT && !g_shutdown) + { + if(get_doc_fail() == 1) + { + set_doc_fail(0); + set_retry_timer(900); + set_global_retry_timestamp(0); + failedDocsRetry(); + WebcfgDebug("After the failedDocsRetry\n"); + } + else + { + time(&t); + wait_flag = 0; + maintenance_count = 0; + WebcfgInfo("Supplementary Sync Interval %d sec and syncing at %s\n",value,ctime(&t)); + } + } else if(g_shutdown) { WebcfgInfo("Received signal interrupt to RFC disable. g_shutdown is %d, proceeding to kill webconfig thread\n", g_shutdown); diff --git a/tests/test_root.c b/tests/test_root.c index a3c2200c..51d59fa3 100644 --- a/tests/test_root.c +++ b/tests/test_root.c @@ -117,7 +117,7 @@ void test_POSTNONE() derive_root_doc_version_string(&root_str, &root_version, http_status); CU_ASSERT_FATAL( NULL != root_str ); - CU_ASSERT_STRING_EQUAL( "NONE-REBOOT", root_str ); + CU_ASSERT_STRING_EQUAL( "POST-NONE", root_str ); fp = fopen("/tmp/webconfig_db.bin","rb"); if(fp !=NULL) {