diff --git a/src/ATrade/Broker/Client.hs b/src/ATrade/Broker/Client.hs index 19f9beb..1a9a130 100644 --- a/src/ATrade/Broker/Client.hs +++ b/src/ATrade/Broker/Client.hs @@ -185,15 +185,11 @@ notificationThread clientIdentity callbacks ctx ep idCounter cmdVar killMv secPa [_, payload] -> case decode (BL.fromStrict payload) of Just notification -> do currentSqnum <- readIORef notifSqnumRef - if getNotificationSqnum notification /= currentSqnum - then - if currentSqnum > getNotificationSqnum notification - then log Debug "Broker.Client" $ "Already processed notification: " <> (T.pack . show) (getNotificationSqnum notification) - else log Warning "Broker.Client" $ + when (getNotificationSqnum notification /= currentSqnum) $ do + log Warning "Broker.Client" $ "Notification sqnum mismatch: " <> (T.pack . show) currentSqnum <> " -> " <> (T.pack . show) (getNotificationSqnum notification) - else do - atomicWriteIORef notifSqnumRef (nextSqnum currentSqnum) - forM_ callbacks $ \c -> c notification + atomicWriteIORef notifSqnumRef (nextSqnum currentSqnum) + forM_ callbacks $ \c -> c notification atomicWriteIORef lastKnownNotificationSqnum currentSqnum _ -> return () _ -> return ()