keep snapshot watcher alive

This commit is contained in:
Robert Habermeier
2016-09-05 14:25:56 +02:00
parent 2bf235e226
commit f0ef5e6943
3 changed files with 27 additions and 0 deletions

View File

@@ -257,6 +257,22 @@ pub fn execute(cmd: RunCmd) -> Result<(), String> {
});
service.register_io_handler(io_handler).expect("Error registering IO handler");
// the watcher must be kept alive.
let _watcher = match cmd.no_periodic_snapshot {
true => None,
false => {
let watcher = Arc::new(snapshot::Watcher::new(
service.client(),
service.io().channel(),
SNAPSHOT_PERIOD,
SNAPSHOT_HISTORY,
));
service.add_notify(watcher.clone());
Some(watcher)
},
};
if !cmd.no_periodic_snapshot {
let watcher = snapshot::Watcher::new(
service.client(),