Skip to content

Commit eaad5d4

Browse files
corey-hammertontimvaillancourt
authored andcommitted
Oplog/Resolver/Resolver.py: De-duplicating code closing the pool (#280)
The close() function is already being called at the end of the stage. The same code present in wait() is needless duplication. This commit removes the duplicated code from wait() and a slight change in the conditions in close().
1 parent 1dbc983 commit eaad5d4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

mongodb_consistent_backup/Oplog/Resolver/Resolver.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def __init__(self, manager, config, timer, base_dir, backup_dir, tailed_oplogs,
5050
logging.fatal("Could not start oplog resolver pool! Error: %s" % e)
5151
raise Error(e)
5252

53-
def close(self, code=None, frame=None):
54-
if self._pool and not self.stopped:
53+
def close(self):
54+
if self._pool and self.stopped:
5555
logging.debug("Stopping all oplog resolver threads")
5656
self._pool.terminate()
5757
logging.info("Stopped all oplog resolver threads")
@@ -102,10 +102,6 @@ def wait(self, max_wait_secs=6 * 3600, poll_secs=2):
102102
waited_secs += poll_secs
103103
else:
104104
raise OperationError("Waited more than %i seconds for Oplog resolver! I will assume there is a problem and exit")
105-
self._pool.terminate()
106-
logging.debug("Stopped all oplog resolver threads")
107-
self.stopped = True
108-
self.running = False
109105

110106
def run(self):
111107
try:

0 commit comments

Comments
 (0)