forked from schmittlauch/Hash2Pub
update responding neighbours and delete unresponding ones from cache
contributes to #44
This commit is contained in:
parent
16b46a8b0b
commit
81e346db4e
|
@ -527,6 +527,9 @@ requestStabilise ns neighbour = do
|
|||
,maybe succAcc (++ succAcc) (stabiliseSuccessors <$> payload msg))
|
||||
)
|
||||
([],[]) respSet
|
||||
-- update successfully responded neighbour in cache
|
||||
now <- getPOSIXTime
|
||||
maybe (pure ()) (\p -> queueAddEntries (Identity $ RemoteCacheEntry (sender p) now) ns) $ headMay (Set.elems respSet)
|
||||
pure $ if null responsePreds && null responseSuccs
|
||||
then Left "no neighbours returned"
|
||||
else Right (responsePreds, responseSuccs)
|
||||
|
|
|
@ -217,8 +217,8 @@ stabiliseThread nsSTM = forever $ do
|
|||
newNs = setPredecessors newPreds . setSuccessors newSuccs $ newerNsSnap
|
||||
writeTVar nsSTM newNs
|
||||
pure newNs
|
||||
|
||||
-- TODO: update successfully stabilised nodes in cache
|
||||
-- delete unresponding nodes from cache as well
|
||||
mapM_ (atomically . writeTQueue (cacheWriteQueue updatedNs) . deleteCacheEntry . getNid) allDeletes
|
||||
|
||||
-- try looking up additional neighbours if list too short
|
||||
forM_ [(length $ predecessors updatedNs)..(kNeighbours updatedNs)] (\_ -> do
|
||||
|
|
Loading…
Reference in a new issue