Commits

Anonymous committed 50ca96d

Fix initial sleep calculation when sleep time is less that RUN_FREQ

Comments (0)

Files changed (2)

python-iview/daily-scrape.py

     # Sleep time for first run, check last run time
     sleeptime = 10 # Sleep for 10 seconds after startup to allow the PC to get a network connection
     lastscrape = getlastrun()
-    if (time.time() - lastscrape) < RUN_FREQ:
-        sleeptime = time.time() - lastscrape
-    print time.time(), sleeptime, lastscrape
+    now = time.time()
+    if (now - lastscrape) < RUN_FREQ:
+        sleeptime = lastscrape + RUN_FREQ - now
+    print now, sleeptime, lastscrape
     while 1:
         nextruntime = time.asctime(time.localtime(time.time() + sleeptime))
         print "Sleeping %d seconds. Will run at: %s" % (sleeptime, nextruntime)

python-iview/handbrake.py

 def makenice():
     '''Make the current process "nice" (or low priority) on most platforms.
     '''
-    if hasattr(os. 'nice'):
+    if hasattr(os, 'nice'):
         os.nice(15)
     else:
         _setpriority()