Skip to content

Commit

Permalink
Keep flame graphs for 6 months
Browse files Browse the repository at this point in the history
Now that we're only running flame graphs on releases, we can keep them for much longer.
  • Loading branch information
erikvanoosten committed Feb 5, 2025
1 parent 4499250 commit a91c4b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/prune-flame-graph.sc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ val indexPath = flameDir / "index.html"
val indexContent = os.read(indexPath)

val liPattern: Regex = """^ *<li>(\d{4}-\d{2}-\d{2}).*href="([0-9a-f]+)".*$""".r
val oneMonthAgo = LocalDate.now.minusMonths(1)

// Flame graphs from before this date are removed.
val flameGraphCutoffDate = LocalDate.now.minusMonths(6)

val (newIndexContentBuilder, removeDirsBuilder) = indexContent
.linesIterator
.foldLeft((Seq.newBuilder[String], Seq.newBuilder[String])) { case ((out, removed), line) =>
line match {
case liPattern(date, dir) if (LocalDate.parse(date) < oneMonthAgo) =>
case liPattern(date, dir) if (LocalDate.parse(date) < flameGraphCutoffDate) =>
(out, removed += dir)
case _ =>
(out += line, removed)
Expand Down

0 comments on commit a91c4b8

Please sign in to comment.