Skip to content

Commit

Permalink
consistently tracking duration for all syncers
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv Bansal committed Sep 20, 2013
1 parent aedc23a commit cb62c80
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 0 additions & 3 deletions lib/wukong-load/syncers/ftp_syncer.rb
Expand Up @@ -10,9 +10,6 @@ class FTPSyncer < Syncer


include Logging include Logging


# Time taken to complete sync.
attr_accessor :duration

# A mapping between protocal names and the standard ports # A mapping between protocal names and the standard ports
# those services run on. # those services run on.
PROTOCOLS = { PROTOCOLS = {
Expand Down
2 changes: 2 additions & 0 deletions lib/wukong-load/syncers/prepare_syncer.rb
Expand Up @@ -201,6 +201,7 @@ def after_sync
# sizes in the `input` directory, but will log a message at the # sizes in the `input` directory, but will log a message at the
# `DEBUG` level for each file it would have processed. # `DEBUG` level for each file it would have processed.
def sync def sync
started_at = Time.now
absolute_input_directory.find do |path| absolute_input_directory.find do |path|
next if path.directory? next if path.directory?
self.files[:examined] += 1 self.files[:examined] += 1
Expand All @@ -210,6 +211,7 @@ def sync
end end
same_size?(path) ? process!(path) : remember_size!(path) same_size?(path) ? process!(path) : remember_size!(path)
end end
self.duration = (Time.now - started_at)
ensure ensure
save_file_state! save_file_state!
end end
Expand Down
3 changes: 0 additions & 3 deletions lib/wukong-load/syncers/s3_syncer.rb
Expand Up @@ -15,9 +15,6 @@ class S3Syncer < Syncer
# Number of bytes synced. # Number of bytes synced.
attr_accessor :bytes attr_accessor :bytes


# Number of seconds taken to complete sync.
attr_accessor :duration

# Construct a new S3Syncer from the given `settings` for the # Construct a new S3Syncer from the given `settings` for the
# given `source` with the given `name`. # given `source` with the given `name`.
# #
Expand Down
3 changes: 3 additions & 0 deletions lib/wukong-load/syncers/syncer.rb
Expand Up @@ -12,6 +12,9 @@ class Syncer
# Name of this syncer. # Name of this syncer.
attr_accessor :name attr_accessor :name


# Time taken to complete sync.
attr_accessor :duration

# Construct a new Syncer from the given `settings` for the given # Construct a new Syncer from the given `settings` for the given
# `source` with the given `name`. # `source` with the given `name`.
# #
Expand Down

0 comments on commit cb62c80

Please sign in to comment.