File tree 1 file changed +10
-2
lines changed
lib/filewatch/read_mode/handlers
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
module FileWatch module ReadMode module Handlers
4
4
class ReadFile < Base
5
+
6
+ # seek file to which ever is furthest: either current bytes read or sincedb position
7
+ private
8
+ def seek_to_furthest_position ( watched_file )
9
+ previous_pos = sincedb_collection . find ( watched_file ) . position
10
+ watched_file . file_seek ( [ watched_file . bytes_read , previous_pos ] . max )
11
+ end
12
+
13
+ public
5
14
def handle_specifically ( watched_file )
6
15
if open_file ( watched_file )
7
16
add_or_update_sincedb_collection ( watched_file ) unless sincedb_collection . member? ( watched_file . sincedb_key )
8
- previous_pos = sincedb_collection . find ( watched_file ) . position
9
- watched_file . file_seek ( [ watched_file . bytes_read , previous_pos ] . max )
17
+ seek_to_furthest_position ( watched_file )
10
18
loop do
11
19
break if quit?
12
20
loop_control = watched_file . loop_control_adjusted_for_stat_size
You can’t perform that action at this time.
0 commit comments