Permalink
Browse files

data_maintainer: better way to handle .looping and .loop_delay

  • Loading branch information...
1 parent bfc650a commit 510b2eb4f944d5a005022155abca42b1905ac665 @markokr committed Mar 4, 2013
Showing with 3 additions and 6 deletions.
  1. +3 −6 scripts/data_maintainer.py
@@ -78,6 +78,7 @@
class DataMaintainer (skytools.DBScript):
__doc__ = __doc__
+ loop_delay = -1
def __init__(self, args):
super(DataMaintainer, self).__init__("data_maintainer", args)
@@ -114,10 +115,6 @@ def __init__(self, args):
# delay in seconds after each commit
self.commit_delay = self.cf.getfloat("commit_delay", 0.0)
- # if loop delay given then we are in looping mode otherwise single loop
- if self.cf.get('loop_delay', -1) == -1:
- self.set_single_loop(1)
-
def work(self):
self.log.info('Starting..')
started = lap_time = time.time()
@@ -165,7 +162,7 @@ def work(self):
self.send_stats()
if len(res) < self.fetchcnt:
break
- if self.last_sigint:
+ if not self.looping:
self.log.info("Exiting on user request")
break
if self.commit_delay > 0.0:
@@ -220,7 +217,7 @@ def process_batch(self, res, mcur, bres):
else:
count += 1
self.stat_increase("count")
- if self.last_sigint:
+ if not self.looping:
break
return count, item
except: # process has crashed, run sql_crash and re-raise the exception

0 comments on commit 510b2eb

Please sign in to comment.