Älä kaadu virheeseen tietovarannon olessa jo alustettu
This commit is contained in:
parent
b2da3220c9
commit
4a27b6a66f
@ -6,12 +6,12 @@ module Main where
|
|||||||
|
|
||||||
import Control.Applicative (optional)
|
import Control.Applicative (optional)
|
||||||
import Control.Concurrent (forkIO, threadDelay)
|
import Control.Concurrent (forkIO, threadDelay)
|
||||||
import Control.Exception (onException)
|
import Control.Exception (onException, catch)
|
||||||
import Control.Exception (throwIO)
|
import Control.Exception (throwIO)
|
||||||
import Control.Monad (void, forever)
|
import Control.Monad (void, forever)
|
||||||
import Data.Acid (AcidState(..), openLocalState, createCheckpoint, createArchive)
|
import Data.Acid (AcidState(..), openLocalState, createCheckpoint, createArchive)
|
||||||
import Data.Acid.Remote (skipAuthenticationCheck, acidServerSockAddr, openRemoteStateSockAddr, skipAuthenticationPerform)
|
import Data.Acid.Remote (skipAuthenticationCheck, acidServerSockAddr, openRemoteStateSockAddr, skipAuthenticationPerform)
|
||||||
import Data.FileStore (gitFileStore, initialize)
|
import Data.FileStore (gitFileStore, initialize, FileStoreError(RepositoryExists))
|
||||||
import Data.IMF (Mailbox(..), parse, mailbox)
|
import Data.IMF (Mailbox(..), parse, mailbox)
|
||||||
import Data.MIME.Charset (defaultCharsets)
|
import Data.MIME.Charset (defaultCharsets)
|
||||||
import Data.Text.Encoding (encodeUtf8)
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
@ -36,7 +36,7 @@ import TiedoteMD.Debug
|
|||||||
|
|
||||||
serverMain :: SockAddr -> Mailbox -> FilePath -> GitOrigin -> FilePath -> Int -> Int -> IO ()
|
serverMain :: SockAddr -> Mailbox -> FilePath -> GitOrigin -> FilePath -> Int -> Int -> IO ()
|
||||||
serverMain socket mail repoPath origin sendmailPath checkpointDelay port = do
|
serverMain socket mail repoPath origin sendmailPath checkpointDelay port = do
|
||||||
initialize $ gitFileStore repoPath
|
initialize (gitFileStore repoPath) `catch` \RepositoryExists -> pure ()
|
||||||
acid <- openLocalState $ emptyState
|
acid <- openLocalState $ emptyState
|
||||||
_ <- forkIO $ acidServerSockAddr skipAuthenticationCheck socket acid
|
_ <- forkIO $ acidServerSockAddr skipAuthenticationCheck socket acid
|
||||||
queueMessages acid
|
queueMessages acid
|
||||||
|
Loading…
Reference in New Issue
Block a user