refactor(health): optimize sql query, needs tests

This commit is contained in:
Steffen Jost 2024-02-06 15:47:17 +00:00
parent 2a0bca1230
commit 67552a666e

View File

@ -130,6 +130,14 @@ mkInterfaceLogTable flagError interfs@(reqIfs, banIfs) = do
E.&&. ilog E.^. InterfaceLogWrite ~~. writ
| (UniqueInterfaceHealth ifce subt writ) <- crits
]
-- let matchUIH crits = E.or
-- [ E.and $ catMaybes
-- [ Just $ ilog E.^. InterfaceLogInterface E.==. E.val (sanitize ifce)
-- , foldMap ((ilog E.^. InterfaceLogSubtype E.==.) . E.val . sanitize) subt
-- , foldMap ((ilog E.^. InterfaceLogWrite E.==.) . E.val ) writ
-- ]
-- | (UniqueInterfaceHealth ifce subt writ) <- crits
-- ]
unless (null reqIfs) $ E.where_ $ matchUIH reqIfs
unless (null banIfs) $ E.where_ $ E.not_ $ matchUIH banIfs
let ihour = E.coalesceDefault [ihealth E.?. InterfaceHealthHours] (E.val $ 3 * 24) -- if no default time is set, use 3 days instead