summaryrefslogtreecommitdiff
path: root/src/Erebos/Storage
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-07-31 20:33:24 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-07-31 20:33:24 +0200
commitc99295bf08f074d65aa03fb16f0173c67de96556 (patch)
tree4924e475dad05a7dd4d541430c801ff566da81c1 /src/Erebos/Storage
parenta9924fedf56d01bb45aa866b78912ca6f5e68bce (diff)
Storage: handle moveKeys being passed the same memory storage
Diffstat (limited to 'src/Erebos/Storage')
-rw-r--r--src/Erebos/Storage/Key.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Erebos/Storage/Key.hs b/src/Erebos/Storage/Key.hs
index b6afc20..5da79e3 100644
--- a/src/Erebos/Storage/Key.hs
+++ b/src/Erebos/Storage/Key.hs
@@ -80,6 +80,7 @@ moveKeys from to = liftIO $ do
return M.empty
(StorageMemory { memKeys = fromKeys }, StorageMemory { memKeys = toKeys }) -> do
- modifyMVar_ fromKeys $ \fkeys -> do
- modifyMVar_ toKeys $ return . M.union fkeys
- return M.empty
+ when (fromKeys /= toKeys) $ do
+ modifyMVar_ fromKeys $ \fkeys -> do
+ modifyMVar_ toKeys $ return . M.union fkeys
+ return M.empty