Skip to content

Commit

Permalink
Added more delays to prevent high CPU load.
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoryvp committed Aug 27, 2012
1 parent 122d91b commit 81cf23c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions parabridge_core/parabridge_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def run( self ) :
sSrc = os.path.expanduser( mTask[ 'src' ] )
sDst = os.path.expanduser( mTask[ 'dst' ] )
self.processTask( mTask[ 'guid' ], mTask[ 'name' ], sSrc, sDst )
## Sleep some time so we don't overuse HDD.
## Sleep some time so we don't overuse HDD and CPU.
time.sleep( 1 )

def processTask( self, i_sGuid, i_sName, i_sSrc, i_sDst ) :
Expand All @@ -68,9 +68,11 @@ def setRes( i_sTxt ) :
for i, sSrcFile in enumerate( lSrcFiles ) :
setRes( "Processing {0}/{1}".format( i + 1, nTotal ) )
if self.processParadoxFile( i_sGuid, sSrcFile, oConn ) :
if self.m_fShutdown :
return
lProcessed.append( True )
if self.m_fShutdown :
return
## Sleep some time so we don't overuse HDD and CPU.
time.sleep( 1 )
sTime = time.strftime( '%Y.%m.%d %H:%M:%S' )
nProcessed = len( lProcessed )
setRes( "Processed {0}/{1} at {2}.".format( nProcessed, nTotal, sTime ) )
Expand Down

0 comments on commit 81cf23c

Please sign in to comment.