Skip to content

Commit

Permalink
Updating the size stats when flushing the buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
quirkey committed Dec 17, 2009
1 parent 553d3b2 commit 7a42ac7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/redisk/io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ def fileno
#
# no newline
def flush
redis.rpush list_key, @buffer if @buffer
if @buffer
redis.rpush list_key, @buffer
@size += @buffer.length
stat.write_attribute(:size, @size)
stat.write_attribute(:mtime, Time.now)
end
@buffer = nil
end

Expand Down Expand Up @@ -742,7 +747,7 @@ def seek(offset, whence = SEEK_SET)
# s.blksize #=> 4096
# s.atime #=> Wed Apr 09 08:53:54 CDT 2003
def stat

@stat ||= Redisk::Stat.new(name)
end

# ios.sync => true or false
Expand Down
2 changes: 1 addition & 1 deletion lib/redisk/stat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def setuid?
#
# File.stat("testfile").size #=> 66
def size
read_attribute('size')
read_attribute('size').to_i
end

# stat.socket? => true or false
Expand Down

0 comments on commit 7a42ac7

Please sign in to comment.