Commit 516ca84e authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] bug MVar fixed

parent 5af7bd5d
Pipeline #1733 passed with stage
in 37 minutes and 24 seconds
...@@ -183,7 +183,6 @@ saveRepo :: ( MonadReader env m, MonadBase IO m, HasNodeStorySaver env ) ...@@ -183,7 +183,6 @@ saveRepo :: ( MonadReader env m, MonadBase IO m, HasNodeStorySaver env )
saveRepo = liftBase =<< view hasNodeStorySaver saveRepo = liftBase =<< view hasNodeStorySaver
listTypeConflictResolution :: ListType -> ListType -> ListType listTypeConflictResolution :: ListType -> ListType -> ListType
listTypeConflictResolution _ _ = undefined -- TODO Use Map User ListType listTypeConflictResolution _ _ = undefined -- TODO Use Map User ListType
...@@ -308,7 +307,8 @@ commitStatePatch listId (Versioned p_version p) = do ...@@ -308,7 +307,8 @@ commitStatePatch listId (Versioned p_version p) = do
assertValid $ transformable p q assertValid $ transformable p q
assertValid $ applicable p' (r ^. r_state) assertValid $ applicable p' (r ^. r_state)
-} -}
printDebug "a version" (a ^. a_version) printDebug "[commitStatePatch] a version" (a ^. a_version)
printDebug "[commitStatePatch] a' version" (a' ^. a_version)
pure ( ns & unNodeStory . at listId .~ (Just a') pure ( ns & unNodeStory . at listId .~ (Just a')
, Versioned (a' ^. a_version) q' , Versioned (a' ^. a_version) q'
) )
...@@ -780,7 +780,6 @@ apiNgramsTableDoc dId = getTableNgramsDoc dId ...@@ -780,7 +780,6 @@ apiNgramsTableDoc dId = getTableNgramsDoc dId
:<|> scoresRecomputeTableNgrams dId :<|> scoresRecomputeTableNgrams dId
:<|> getTableNgramsVersion dId :<|> getTableNgramsVersion dId
:<|> apiNgramsAsync dId :<|> apiNgramsAsync dId
-- > index all the corpus accordingly (TODO AD)
apiNgramsAsync :: NodeId -> GargServer TableNgramsAsyncApi apiNgramsAsync :: NodeId -> GargServer TableNgramsAsyncApi
apiNgramsAsync _dId = apiNgramsAsync _dId =
......
...@@ -18,7 +18,7 @@ module Gargantext.Core.NodeStory where ...@@ -18,7 +18,7 @@ module Gargantext.Core.NodeStory where
-- import Debug.Trace (traceShow) -- import Debug.Trace (traceShow)
import Codec.Serialise (serialise, deserialise) import Codec.Serialise (serialise, deserialise)
import Codec.Serialise.Class import Codec.Serialise.Class
import Control.Concurrent (MVar(), withMVar, newMVar) import Control.Concurrent (MVar(), withMVar, newMVar, modifyMVar_)
import Control.Debounce (mkDebounce, defaultDebounceSettings, debounceFreq, debounceAction) import Control.Debounce (mkDebounce, defaultDebounceSettings, debounceFreq, debounceAction)
import Control.Lens (makeLenses, Getter, (^.)) import Control.Lens (makeLenses, Getter, (^.))
import Control.Monad.Except import Control.Monad.Except
...@@ -98,8 +98,8 @@ nodeStoryVar :: NodeStoryDir ...@@ -98,8 +98,8 @@ nodeStoryVar :: NodeStoryDir
-> IO (MVar NodeListStory) -> IO (MVar NodeListStory)
nodeStoryVar nsd Nothing ni = nodeStoryInc nsd Nothing ni >>= newMVar nodeStoryVar nsd Nothing ni = nodeStoryInc nsd Nothing ni >>= newMVar
nodeStoryVar nsd (Just mv) ni = do nodeStoryVar nsd (Just mv) ni = do
mv' <- withMVar mv pure _ <- modifyMVar_ mv $ \mv' -> (nodeStoryInc nsd (Just mv') ni)
nodeStoryInc nsd (Just mv') ni >>= newMVar pure mv
nodeStoryInc :: NodeStoryDir -> Maybe NodeListStory -> NodeId -> IO NodeListStory nodeStoryInc :: NodeStoryDir -> Maybe NodeListStory -> NodeId -> IO NodeListStory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment