mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
pull the cron time() call up a level to trim some of the overhead off
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@787 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -303,19 +303,19 @@ CCron::CCron()
|
||||
m_bPause = false;
|
||||
}
|
||||
|
||||
void CCron::run()
|
||||
void CCron::run( time_t iNow )
|
||||
{
|
||||
if ( m_bPause )
|
||||
return;
|
||||
|
||||
if ( ( m_bActive ) && ( time( NULL ) >= m_iTime ) )
|
||||
if ( ( m_bActive ) && ( iNow >= m_iTime ) )
|
||||
{
|
||||
RunJob();
|
||||
|
||||
if ( ( m_iMaxCycles > 0 ) && ( ++m_iCycles >= m_iMaxCycles ) )
|
||||
m_bActive = false;
|
||||
else
|
||||
m_iTime = time( NULL ) + m_iTimeSequence;
|
||||
m_iTime = iNow + m_iTimeSequence;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1657,6 +1657,7 @@ unsigned long long Csock::GetRateTime() { return( m_iMaxMilliSeconds ); }
|
||||
|
||||
void Csock::Cron()
|
||||
{
|
||||
time_t iNow = time( NULL );
|
||||
for( vector<CCron *>::size_type a = 0; a < m_vcCrons.size(); a++ )
|
||||
{
|
||||
CCron *pcCron = m_vcCrons[a];
|
||||
@@ -1666,7 +1667,7 @@ void Csock::Cron()
|
||||
CS_Delete( pcCron );
|
||||
m_vcCrons.erase( m_vcCrons.begin() + a-- );
|
||||
} else
|
||||
pcCron->run();
|
||||
pcCron->run( iNow );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user