Skip to content

Commit c62f778

Browse files
committed
[piper] some cleanup
1 parent 38717e0 commit c62f778

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/piper.looper.cc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131
#include <filesystem>
3232
#include <future>
3333
#include <map>
34+
#include <memory>
35+
#include <optional>
36+
#include <string>
3437
#include <thread>
35-
#include <unordered_set>
38+
#include <utility>
39+
#include <vector>
3640

3741
#include "piper.looper.hh"
3842

@@ -43,6 +47,8 @@
4347
#include "base/date_time_scanner.hh"
4448
#include "base/fs_util.hh"
4549
#include "base/injector.hh"
50+
#include "base/lnav.console.hh"
51+
#include "base/lnav_log.hh"
4652
#include "base/piper.file.hh"
4753
#include "base/time_util.hh"
4854
#include "config.h"
@@ -184,8 +190,9 @@ demux_json_string(yajlpp_parse_context* ypc,
184190
auto* dju = static_cast<demux_json_userdata*>(ypc->ypc_userdata);
185191
auto path_sf = ypc->get_path_as_string_fragment();
186192
auto value_sf = string_fragment::from_bytes(str, len);
187-
if (str < dju->dju_input.udata() ||
188-
dju->dju_input.udata() + dju->dju_input.length() < str) {
193+
if (str < dju->dju_input.udata()
194+
|| dju->dju_input.udata() + dju->dju_input.length() < str)
195+
{
189196
value_sf = value_sf.to_owned(*dju->dju_arena);
190197
}
191198

@@ -941,9 +948,10 @@ cleanup()
941948
for (const auto& entry :
942949
std::filesystem::directory_iterator(cache_subdir, ec))
943950
{
944-
auto mtime = std::filesystem::last_write_time(entry.path());
945-
auto exp_time = mtime + cfg.c_ttl;
946-
if (now < exp_time) {
951+
auto entry_mtime
952+
= std::filesystem::last_write_time(entry.path());
953+
auto entry_exp_time = entry_mtime + cfg.c_ttl;
954+
if (now < entry_exp_time) {
947955
is_recent = true;
948956
break;
949957
}

0 commit comments

Comments
 (0)