Skip to content

Commit 70ed56d

Browse files
andseljsvd
andauthored
Simplify the logic to update and seek the watched_file position
Co-authored-by: João Duarte <[email protected]>
1 parent ac6a4b8 commit 70ed56d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: lib/filewatch/read_mode/handlers/read_file.rb

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ module FileWatch module ReadMode module Handlers
44
class ReadFile < Base
55
def handle_specifically(watched_file)
66
if open_file(watched_file)
7-
add_or_update_sincedb_collection(watched_file) unless sincedb_collection.member?(watched_file.sincedb_key)
8-
if sincedb_collection.member?(watched_file.sincedb_key)
9-
previous_pos = sincedb_collection.find(watched_file).position
10-
watched_file.file_seek([watched_file.bytes_read, previous_pos].max)
11-
end
7+
add_or_update_sincedb_collection(watched_file)
8+
watched_file.file_seek(watched_file.bytes_read)
129
loop do
1310
break if quit?
1411
loop_control = watched_file.loop_control_adjusted_for_stat_size

0 commit comments

Comments
 (0)