Skip to content

Commit 055c45e

Browse files
committed
fixed:database thread time is incorrent
1 parent 83a3739 commit 055c45e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

XEngine_Source/StorageModule_Database/Database_File/Database_File.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,13 +634,14 @@ XHTHREAD CDatabase_File::Database_File_Thread(XPVOID lParam)
634634

635635
while (pClass_This->bIsRun)
636636
{
637+
nTimeEnd = time(NULL);
637638
if ((nTimeEnd - nTimeStart) > nTime)
638639
{
640+
nTimeStart = nTimeEnd;
639641
pClass_This->Database_File_TimeDel();
640642
pClass_This->Database_File_CreateTable();
641643
}
642-
nTimeEnd = time(NULL);
643-
std::this_thread::sleep_for(std::chrono::milliseconds(10));
644+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
644645
}
645646
return 0;
646647
}

XEngine_Source/StorageModule_Database/Database_Memory/Database_Memory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ XHTHREAD CDatabase_Memory::Database_Memory_Thread(XPVOID lParam)
306306
CDatabase_Memory *pClass_This = (CDatabase_Memory *)lParam;
307307
time_t nTimeStart = time(NULL);
308308
time_t nTimeEnd = 0;
309-
int nTime = 60;
309+
int nTime = 60 * 60 * 12;
310310

311311
while (pClass_This->m_bIsRun)
312312
{
@@ -316,7 +316,7 @@ XHTHREAD CDatabase_Memory::Database_Memory_Thread(XPVOID lParam)
316316
nTimeStart = nTimeEnd;
317317
pClass_This->Database_Memory_Flush();
318318
}
319-
std::this_thread::sleep_for(std::chrono::milliseconds(10));
319+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
320320
}
321321
return 0;
322322
}

0 commit comments

Comments
 (0)