Skip to content

Commit

Permalink
Merge pull request xmidt-org#228 from vasuki01/forcesyncfix
Browse files Browse the repository at this point in the history
Force sync got stuck with in progress error when both force sync and …
  • Loading branch information
sadhyama authored Jun 13, 2024
2 parents d46b2b2 + 80e5e88 commit 5bd98c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
39 changes: 19 additions & 20 deletions src/webcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/test_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 5bd98c9

Please sign in to comment.