launch background worker threads

This commit is contained in:
Trolli Schmittlauch 2020-09-10 12:00:17 +02:00
parent f8d30d0cc4
commit 3c76544afb

View file

@ -121,8 +121,8 @@ instance DHT d => Service PostService d where
-- web server -- web server
(Warp.runSettings warpSettings $ postServiceApplication thisService) (Warp.runSettings warpSettings $ postServiceApplication thisService)
$ concurrently $ concurrently
-- post queue processing -- background processing workers
(processIncomingPosts thisService) (launchWorkerThreads thisService)
-- statistics/ measurements -- statistics/ measurements
(launchStatsThreads thisService) (launchStatsThreads thisService)
-- update thread ID after fork -- update thread ID after fork
@ -604,6 +604,12 @@ instance {-# OVERLAPPABLE #-} Read a => MimeUnrender PlainText a where
-- TODO: make configurable -- TODO: make configurable
numParallelDeliveries = 10 numParallelDeliveries = 10
launchWorkerThreads :: DHT d => PostService d -> IO ()
launchWorkerThreads serv = concurrently_
(processIncomingPosts serv)
$ concurrently_
(fetchTagPosts serv)
(relayWorker serv)
-- | process the pending relay inbox of incoming posts from the internal queue: -- | process the pending relay inbox of incoming posts from the internal queue:
-- Look up responsible relay node for given hashtag and forward post to it -- Look up responsible relay node for given hashtag and forward post to it