We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b09a3b commit 8bd39c7Copy full SHA for 8bd39c7
1 file changed
src/FitSpec.API/Program.cs
@@ -90,11 +90,18 @@
90
}
91
92
app.UseCors("Angular");
93
+
94
+var lastDbPing = DateTime.MinValue;
95
app.MapGet("/health", async (IDapperConnectionFactory db) =>
96
{
- using var conn = db.CreateConnection();
- await conn.ExecuteScalarAsync<int>("SELECT 1");
97
- return Results.Ok(new { status = "healthy", timestamp = DateTime.UtcNow });
+ var now = DateTime.UtcNow;
98
+ if ((now - lastDbPing).TotalMinutes >= 5)
99
+ {
100
+ using var conn = db.CreateConnection();
101
+ await conn.ExecuteScalarAsync<int>("SELECT 1");
102
+ lastDbPing = now;
103
+ }
104
+ return Results.Ok(new { status = "healthy", timestamp = now });
105
});
106
app.MapControllers();
107
app.MapHub<FitSpec.API.Hubs.InventoryHub>("/hubs/inventory");
0 commit comments