diff --git a/lib/wukong-load/syncers/ftp_syncer.rb b/lib/wukong-load/syncers/ftp_syncer.rb index 65da87f..7d27230 100644 --- a/lib/wukong-load/syncers/ftp_syncer.rb +++ b/lib/wukong-load/syncers/ftp_syncer.rb @@ -10,9 +10,6 @@ class FTPSyncer < Syncer include Logging - # Time taken to complete sync. - attr_accessor :duration - # A mapping between protocal names and the standard ports # those services run on. PROTOCOLS = { diff --git a/lib/wukong-load/syncers/prepare_syncer.rb b/lib/wukong-load/syncers/prepare_syncer.rb index e7de20c..943fb32 100644 --- a/lib/wukong-load/syncers/prepare_syncer.rb +++ b/lib/wukong-load/syncers/prepare_syncer.rb @@ -201,6 +201,7 @@ def after_sync # sizes in the `input` directory, but will log a message at the # `DEBUG` level for each file it would have processed. def sync + started_at = Time.now absolute_input_directory.find do |path| next if path.directory? self.files[:examined] += 1 @@ -210,6 +211,7 @@ def sync end same_size?(path) ? process!(path) : remember_size!(path) end + self.duration = (Time.now - started_at) ensure save_file_state! end diff --git a/lib/wukong-load/syncers/s3_syncer.rb b/lib/wukong-load/syncers/s3_syncer.rb index 1b5345f..337864b 100644 --- a/lib/wukong-load/syncers/s3_syncer.rb +++ b/lib/wukong-load/syncers/s3_syncer.rb @@ -15,9 +15,6 @@ class S3Syncer < Syncer # Number of bytes synced. attr_accessor :bytes - # Number of seconds taken to complete sync. - attr_accessor :duration - # Construct a new S3Syncer from the given `settings` for the # given `source` with the given `name`. # diff --git a/lib/wukong-load/syncers/syncer.rb b/lib/wukong-load/syncers/syncer.rb index 9913b73..bdcc33d 100644 --- a/lib/wukong-load/syncers/syncer.rb +++ b/lib/wukong-load/syncers/syncer.rb @@ -12,6 +12,9 @@ class Syncer # Name of this syncer. attr_accessor :name + # Time taken to complete sync. + attr_accessor :duration + # Construct a new Syncer from the given `settings` for the given # `source` with the given `name`. #