git.iko.soy/distributed-process
on master help sign in
Fix getNodeStats function, see DP-97
16fd0e2Alexander Vershilov
src/Control/Distributed/Process/Internal/Primitives.hs+4−4
@@ -757,11 +757,11 @@ getNodeStats nid = do
757 selfNode <- getSelfNode
757 selfNode <- getSelfNode
758 if nid == selfNode
758 if nid == selfNode
759 then Right `fmap` getLocalNodeStats -- optimisation
759 then Right `fmap` getLocalNodeStats -- optimisation
760− else getNodeStatsRemote
760+ else getNodeStatsRemote selfNode
761 where
761 where
762− getNodeStatsRemote :: Process (Either DiedReason NodeStats)
762+ getNodeStatsRemote :: NodeId -> Process (Either DiedReason NodeStats)
763− getNodeStatsRemote = do
763+ getNodeStatsRemote selfNode = do
764− sendCtrlMsg (Just nid) $ GetNodeStats nid
764+ sendCtrlMsg (Just nid) $ GetNodeStats selfNode
765 bracket (monitorNode nid) unmonitor $ \mRef ->
765 bracket (monitorNode nid) unmonitor $ \mRef ->
766 receiveWait [ match (\(stats :: NodeStats) -> return $ Right stats)
766 receiveWait [ match (\(stats :: NodeStats) -> return $ Right stats)
767 , matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef)
767 , matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef)