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
(Warp.runSettings warpSettings $ postServiceApplication thisService)
$ concurrently
-- post queue processing
(processIncomingPosts thisService)
-- background processing workers
(launchWorkerThreads thisService)
-- statistics/ measurements
(launchStatsThreads thisService)
-- update thread ID after fork
@ -604,6 +604,12 @@ instance {-# OVERLAPPABLE #-} Read a => MimeUnrender PlainText a where
-- TODO: make configurable
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:
-- Look up responsible relay node for given hashtag and forward post to it