From 1cef17a369593accfcc2a04bf6b17454edbed181 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sat, 12 Mar 2022 11:51:38 -0800 Subject: [PATCH] Fixed error with walsender queries on live queries page - fixes #394 --- CHANGELOG.md | 4 ++++ .../pg_hero/home/_live_queries_table.html.erb | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cee878820..62474854b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.8.3 (unreleased) + +- Fixed error with walsender queries on live queries page + ## 2.8.2 (2021-12-15) - Fixed sorting by name on space page when historical space stats are not enabled diff --git a/app/views/pg_hero/home/_live_queries_table.html.erb b/app/views/pg_hero/home/_live_queries_table.html.erb index b59591076..5a5bf96df 100644 --- a/app/views/pg_hero/home/_live_queries_table.html.erb +++ b/app/views/pg_hero/home/_live_queries_table.html.erb @@ -12,14 +12,16 @@ <%= query[:pid] %> - <% sec = query[:duration_ms] / 1000.0 %> - <% if sec < 1.minute %> - <%= sec.round(1) %> s - <% elsif sec < 1.day %> - <%= Time.at(sec).utc.strftime("%H:%M:%S") %> - <% else %> - <% days = (sec / 1.day).floor %> - <%= days %>d <%= Time.at(sec - days.days).utc.strftime("%H:%M:%S") %> + <% if query[:duration_ms] %> + <% sec = query[:duration_ms] / 1000.0 %> + <% if sec < 1.minute %> + <%= sec.round(1) %> s + <% elsif sec < 1.day %> + <%= Time.at(sec).utc.strftime("%H:%M:%S") %> + <% else %> + <% days = (sec / 1.day).floor %> + <%= days %>d <%= Time.at(sec - days.days).utc.strftime("%H:%M:%S") %> + <% end %> <% end %>