newtype MapLog
Noticed that Semigroup instance of Map is not suitable to use for MapLog. For example, it behaved like this: ghci> parseTrustLog "foo 1 timestamp=10\nfoo 2 timestamp=11" <> parseTrustLog "foo X timestamp=12" fromList [(UUID "foo",LogEntry {changed = VectorClock 11s, value = SemiTrusted})] Which was wrong, it lost the newer DeadTrusted value. Luckily, nothing used that Semigroup when operating on a MapLog. And this provides a safe instance. Sponsored-by: Graham Spencer on Patreon
This commit is contained in:
parent
5d8b8a8ad0
commit
38b9ebc5fd
8 changed files with 74 additions and 44 deletions
|
@ -73,7 +73,7 @@ start (Expire expire) noact actlog descs u =
|
|||
trustSet u DeadTrusted
|
||||
next $ return True
|
||||
where
|
||||
lastact = changed <$> M.lookup u actlog
|
||||
lastact = changed <$> M.lookup u (fromMapLog actlog)
|
||||
whenactive = case lastact of
|
||||
Just (VectorClock c) -> do
|
||||
d <- liftIO $ durationSince $ posixSecondsToUTCTime c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue