avoid nub

There will not usually be many live changes, but usually does not mean
ever, and O(N^2) is best avoided.
This commit is contained in:
Joey Hess 2024-08-27 15:00:10 -04:00
parent 0a119184e6
commit b01a63ef62
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -355,7 +355,8 @@ liveRepoOffsets :: RepoSizeHandle -> IO (M.Map UUID SizeOffset)
liveRepoOffsets (RepoSizeHandle (Just h)) = H.queryDb h $ do liveRepoOffsets (RepoSizeHandle (Just h)) = H.queryDb h $ do
sizechanges <- getSizeChanges sizechanges <- getSizeChanges
livechanges <- getLiveSizeChanges livechanges <- getLiveSizeChanges
let us = nub (M.keys sizechanges ++ M.keys livechanges) let us = S.toList $ S.fromList $
M.keys sizechanges ++ M.keys livechanges
M.fromList <$> forM us (go sizechanges livechanges) M.fromList <$> forM us (go sizechanges livechanges)
where where
go sizechanges livechanges u = do go sizechanges livechanges u = do