summaryrefslogtreecommitdiff
path: root/deps/discord-haskell/src/Discord/Internal/Gateway.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-01-11 20:42:57 -0500
committerLLLL Colonq <llll@colonq>2024-01-11 20:42:57 -0500
commitae18b594c97782cc201ffa365f12064831b1ec93 (patch)
tree5570a7f8ab15a113f332839b900c2c47444e7314 /deps/discord-haskell/src/Discord/Internal/Gateway.hs
parent0be357bb60a2bc4523056aba34add78b715211f5 (diff)
Handle stickers, properly handle exceptions in threads
Diffstat (limited to 'deps/discord-haskell/src/Discord/Internal/Gateway.hs')
-rw-r--r--deps/discord-haskell/src/Discord/Internal/Gateway.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/deps/discord-haskell/src/Discord/Internal/Gateway.hs b/deps/discord-haskell/src/Discord/Internal/Gateway.hs
index f07be39..a31c4de 100644
--- a/deps/discord-haskell/src/Discord/Internal/Gateway.hs
+++ b/deps/discord-haskell/src/Discord/Internal/Gateway.hs
@@ -7,6 +7,7 @@ module Discord.Internal.Gateway
, CacheHandle(..)
, GatewayException(..)
, Cache(..)
+ , initializeCache
, startCacheThread
, startGatewayThread
, module Discord.Internal.Types
@@ -21,13 +22,13 @@ import Data.Time (getCurrentTime)
import Discord.Internal.Types (Auth, EventInternalParse, GatewayIntent)
import Discord.Internal.Gateway.EventLoop (connectionLoop, GatewayHandle(..), GatewayException(..))
-import Discord.Internal.Gateway.Cache (cacheLoop, Cache(..), CacheHandle(..))
+import Discord.Internal.Gateway.Cache (cacheLoop, Cache(..), CacheHandle(..), initializeCache)
-- | Starts a thread for the cache
startCacheThread :: Bool -> Chan T.Text -> IO (CacheHandle, ThreadId)
startCacheThread isEnabled log = do
events <- newChan :: IO (Chan (Either GatewayException EventInternalParse))
- cache <- newEmptyMVar :: IO (MVar (Either (Cache, GatewayException) Cache))
+ cache <- newEmptyMVar :: IO (MVar Cache)
let cacheHandle = CacheHandle events cache
tid <- forkIO $ cacheLoop isEnabled cacheHandle log
pure (cacheHandle, tid)