Skip to content

Commit da55abd

Browse files
Start Notifier early at init time in Main.py, not when backup begins
1 parent 93af5d6 commit da55abd

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

mongodb_consistent_backup/Main.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self, prog_name="mongodb-consistent-backup"):
5757
self.get_lock()
5858
self.logger.update_symlink()
5959
self.init()
60+
self.setup_notifier()
6061
self.set_backup_dirs()
6162
self.get_db_conn()
6263
self.setup_state()
@@ -98,6 +99,18 @@ def setup_state(self):
9899
self.state = StateBackup(self.backup_directory, self.config, self.backup_time, self.uri, sys.argv)
99100
self.state.write()
100101

102+
def setup_notifier(self):
103+
try:
104+
self.notify = Notify(
105+
self.manager,
106+
self.config,
107+
self.timer,
108+
self.backup_root_subdirectory,
109+
self.backup_directory
110+
)
111+
except Exception, e:
112+
self.exception("Problem starting notifier! Error: %s" % e, e)
113+
101114
def get_db_conn(self):
102115
self.uri = MongoUri(self.config.host, self.config.port)
103116
try:
@@ -237,18 +250,6 @@ def run(self):
237250
except Exception, e:
238251
self.exception("Problem starting archiver! Error: %s" % e, e)
239252

240-
# Setup the notifier
241-
try:
242-
self.notify = Notify(
243-
self.manager,
244-
self.config,
245-
self.timer,
246-
self.backup_root_subdirectory,
247-
self.backup_directory
248-
)
249-
except Exception, e:
250-
self.exception("Problem starting notifier! Error: %s" % e, e)
251-
252253
# Setup the uploader
253254
try:
254255
self.upload = Upload(

0 commit comments

Comments
 (0)