Skip to content

Commit 2d5e5da

Browse files
committed
[file_collection] recursive watch should inherit time range
1 parent 11d0147 commit 2d5e5da

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/file_collection.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ file_collection::watch_logfile(const std::string& filename,
356356
wilddir,
357357
logfile_open_options()
358358
.with_non_utf_visibility(false)
359-
.with_visible_size_limit(256 * 1024));
359+
.with_visible_size_limit(256 * 1024)
360+
.with_time_range(loo.loo_time_range));
360361
return lnav::futures::make_ready_future(std::move(retval));
361362
}
362363
return std::nullopt;
@@ -424,9 +425,6 @@ file_collection::watch_logfile(const std::string& filename,
424425
return std::nullopt;
425426
}
426427

427-
log_trace("wtf %d %d",
428-
this->fc_files.size(),
429-
this->fc_files_high_mark.value_or(0));
430428
if (this->fc_files_high_mark
431429
&& this->fc_files.size() >= this->fc_files_high_mark.value())
432430
{

src/logfile.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ void
395395
logfile::build_content_map(const struct stat& st)
396396
{
397397
this->lf_content_map.clear();
398-
this->lf_file_size_at_map_time = st.st_size;
398+
this->lf_file_size_at_map_time = this->lf_index_size;
399399

400400
if (this->lf_index_size == this->get_content_size()) {
401401
log_trace("%s: file has already been scanned, no need to peek",
@@ -1595,7 +1595,7 @@ logfile::rebuild_index(std::optional<ui_clock::time_point> deadline)
15951595
if (this->lf_format != nullptr
15961596
&& (this->lf_index.size() >= RETRY_MATCH_SIZE
15971597
|| this->lf_index_size == this->get_content_size())
1598-
&& this->lf_file_size_at_map_time != st.st_size)
1598+
&& this->lf_file_size_at_map_time != this->lf_index_size)
15991599
{
16001600
this->build_content_map(st);
16011601
}

src/logfile_sub_source.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ logfile_sub_source::rebuild_index(std::optional<ui_clock::time_point> deadline)
911911
log_debug("forced to full rebuild");
912912
retval = rebuild_result::rr_full_rebuild;
913913
full_sort = true;
914+
this->lss_index.clear();
914915
}
915916

916917
std::vector<size_t> file_order(this->lss_files.size());

src/logfile_sub_source.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ public:
463463
{
464464
this->ld_filter_state.lfo_filter_state.tfs_logfile = lf;
465465
this->ld_file_ptr = lf.get();
466+
this->ld_lines_indexed = 0;
467+
this->ld_lines_watched = 0;
468+
this->ld_visible = lf->is_indexing();
466469
lf->set_logline_observer(&this->ld_filter_state);
467470
}
468471

0 commit comments

Comments
 (0)