summaryrefslogtreecommitdiff
path: root/cmds/dumpstate/dumpstate.cpp
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2019-10-01 16:24:42 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-10-01 16:24:42 +0000
commite98cb32bba64264b55a8e8260fee198e9cd86d56 (patch)
tree93ec9b003710e74f0dc5fc9c75f4e9e74035db83 /cmds/dumpstate/dumpstate.cpp
parent7f10d41dc3d7f40ecb1b442448a9d9317753148c (diff)
parentdb6d211edf83b3cb71a85439f2b65013c82be86d (diff)
Merge "dumpstate: remove the arbitrary limit on tombstones."
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
-rw-r--r--cmds/dumpstate/dumpstate.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index bedf81fb04..4674d2a28a 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -300,12 +300,10 @@ static const CommandOptions AS_ROOT_20 = CommandOptions::WithTimeout(20).AsRoot(
* Returns a vector of dump fds under |dir_path| with a given |file_prefix|.
* The returned vector is sorted by the mtimes of the dumps. If |limit_by_mtime|
* is set, the vector only contains files that were written in the last 30 minutes.
- * If |limit_by_count| is set, the vector only contains the ten latest files.
*/
static std::vector<DumpData> GetDumpFds(const std::string& dir_path,
const std::string& file_prefix,
- bool limit_by_mtime,
- bool limit_by_count = true) {
+ bool limit_by_mtime) {
const time_t thirty_minutes_ago = ds.now_ - 60 * 30;
std::unique_ptr<DIR, decltype(&closedir)> dump_dir(opendir(dir_path.c_str()), closedir);
@@ -349,15 +347,6 @@ static std::vector<DumpData> GetDumpFds(const std::string& dir_path,
dump_data.emplace_back(DumpData{abs_path, std::move(fd), st.st_mtime});
}
- // Sort in descending modification time so that we only keep the newest
- // reports if |limit_by_count| is true.
- std::sort(dump_data.begin(), dump_data.end(),
- [](const DumpData& d1, const DumpData& d2) { return d1.mtime > d2.mtime; });
-
- if (limit_by_count && dump_data.size() > 10) {
- dump_data.erase(dump_data.begin() + 10, dump_data.end());
- }
-
return dump_data;
}