From 2e526fe122b3622adad79e49facb9558d409271d Mon Sep 17 00:00:00 2001 From: Saku Laesvuori Date: Sat, 2 Sep 2023 13:22:37 +0300 Subject: [PATCH] =?UTF-8?q?Vastaa=20webhook-ilmoituksiin=20v=C3=A4litt?= =?UTF-8?q?=C3=B6m=C3=A4sti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tämä korjaa ongelman, jossa gitean webhookin http-kysely ehtii vanhentua ennen kuin siihen on vastattu. Ilmoituksia lähettävän järjestelmän ei myöskään tarvitse tietää kauanko ilmoitusten prosessointi kestää. --- src/Main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index 93db179..126da85 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -7,6 +7,7 @@ module Main where import Control.Concurrent (forkIO) import Control.Exception (onException) import Control.Exception (throwIO) +import Control.Monad (void) import Data.Acid (openLocalState) import Data.Acid.Remote (skipAuthenticationCheck, acidServerSockAddr, openRemoteStateSockAddr, skipAuthenticationPerform) import Data.IMF (Mailbox, parse, mailbox) @@ -38,7 +39,7 @@ serverMain socket mail repoPath sendmailPath = do queueMessages acid _ <- forkIO $ scotty 3000 $ do defaultHandler $ liftAndCatchIO . LT.putStrLn -- Don't return exceptions to clients - post "/" $ liftAndCatchIO $ updateMessages acid repoPath + post "/" $ liftAndCatchIO $ void $ forkIO $ updateMessages acid repoPath updateMessages acid repoPath _ <- forkIO $ manageQueueingMessages acid _ <- forkIO $ managePreviews acid mail sendmailPath