diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-10-18 08:31:32 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-10-18 08:31:32 +0300 |
commit | 0c7cc2b302702dfddc64f7c172145074939deee6 (patch) | |
tree | b74e688600aadee285879bd627992f179a6c24fc | |
parent | 6c344b130485a3fed4a015409d10f6e7576c5961 (diff) | |
download | obnam-0c7cc2b302702dfddc64f7c172145074939deee6.tar.gz |
Flush after dirs, not files
-rw-r--r-- | obnamlib/plugins/backup_plugin.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py index 9597f845..63e2c59c 100644 --- a/obnamlib/plugins/backup_plugin.py +++ b/obnamlib/plugins/backup_plugin.py @@ -387,14 +387,12 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.root_metadata = self.fs.lstat(absroot) - num_files = 0 + num_dirs = 0 flush_threshold = 1000 for pathname, metadata in self.find_files(absroot): logging.info('Backing up %s', pathname) - num_files += 1 - if not self.pretend: existed = self.repo.file_exists(self.new_generation, pathname) try: @@ -412,10 +410,12 @@ class BackupPlugin(obnamlib.ObnamPlugin): if e.errno in (errno.ENOSPC, errno.EPIPE): raise - if metadata.isdir() and not self.pretend and num_files >= flush_threshold: - self.repo.flush_client(self.client_name) - self.app.dump_memory_profile('after flushing client') - num_files = 0 + if metadata.isdir() and not self.pretend: + num_dirs += 1 + if num_dirs >= flush_threshold: + self.repo.flush_client(self.client_name) + self.app.dump_memory_profile('after flushing client') + num_files = 0 if self.checkpoint_manager.time_for_checkpoint(): self.make_checkpoint() |