Skip to content

Commit

Permalink
Fix some reset
Browse files Browse the repository at this point in the history
  • Loading branch information
rbourgeat committed Jan 5, 2025
1 parent 1ce66b2 commit 779c2c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ function resetDailyPings() {
const lastDay = service.dailyHistory[service.dailyHistory.length - 1];
if (lastDay.date !== today) {
service.currentDayPings = { online: 0, total: 0 };
service.incidentReported = false;
service.downtimeStart = null;
}
}
});
Expand Down Expand Up @@ -479,7 +481,7 @@ fs.watch(CONFIG_FILE, () => {

setInterval(resetDailyPings, 1000 * 60 * 60 * 24);

setInterval(updateStatuses, 1000);
setInterval(updateStatuses, 5000);

app.get("/api/incidents", async (req, res) => {
const incidents = await fetchPastIncidents();
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,16 @@ export default function Home() {
{averageUptime}% uptime
</h2>
<div className="absolute left-1/2 mb-2 hidden max-w-max w-auto whitespace-nowrap px-4 py-2 text-xs font-medium text-white translate-x-1/2 group-hover:block rounded-xl backdrop-blur-2xl border border-[#727DA1]/20 bg-[#171824]/80">
{status.pingInterval ? (
<p className="flex items-center space-x-2 text-gray-400">
<FaHourglassHalf />
<span>Ping every {status.pingInterval / 1000}s</span>
</p>
) : (
<p className="flex items-center space-x-2 text-gray-400">
Ping interval not available
</p>
)}
{status.address && (
<p className="flex items-center space-x-2 text-gray-400">
<FaLink />
Expand Down Expand Up @@ -239,9 +245,9 @@ export default function Home() {
? "text-gray-400"
: day.downtimeHours?.toFixed(1) == 0
? "text-green-400"
: day.downtimeHours?.toFixed(1) <= 0.1
: day.downtimeHours?.toFixed(1) <= 0.25
? "text-yellow-400"
: day.downtimeHours?.toFixed(1) <= 0.3
: day.downtimeHours?.toFixed(1) <= 0.5
? "text-orange-400"
: "text-red-500"
}`}>
Expand Down

0 comments on commit 779c2c3

Please sign in to comment.