Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 7d6cb7e

Browse files
author
Haskell-mouse
committed
[AD-347] Revert changes in MainTemplate.hs
Revert unnecessary changes in the file.
1 parent ff7f813 commit 7d6cb7e

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

ariadne/cardano/src/Ariadne/MainTemplate.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ module Ariadne.MainTemplate
77

88
import Control.Concurrent (forkIO, myThreadId, throwTo)
99
import Control.Concurrent.Async
10-
(Async(..), AsyncCancelled(..), ExceptionInLinkedThread(..), race_,
11-
waitCatch, withAsync)
10+
(Async(..), AsyncCancelled(..), ExceptionInLinkedThread(..), concurrently,
11+
race_, waitCatch, withAsync)
1212
import Control.Monad.Component (ComponentM, runComponentM)
1313
import Control.Natural (($$))
1414
import Data.Version (Version)
@@ -25,7 +25,7 @@ import Ariadne.Config.History (HistoryConfig(..))
2525
import Ariadne.Config.Logging (LoggingConfig(..))
2626
import Ariadne.Config.Wallet (WalletConfig(..))
2727
import Ariadne.Knit.Backend (Components, KnitFace, createKnitBackend)
28-
import Ariadne.Logging (Logging, loggingComponent)
28+
import Ariadne.Logging (Logging, logDebug, loggingComponent)
2929
import Ariadne.TaskManager.Backend
3030
import Ariadne.Update.Backend
3131
import Ariadne.UX.CommandHistory
@@ -89,7 +89,7 @@ defaultMain settings = do
8989

9090
initializeEverything
9191
:: forall uiComponents uiFace uiLangFace.
92-
(Components (AllComponents uiComponents))
92+
(Components (AllComponents uiComponents), HasCallStack)
9393
=> MainSettings uiComponents uiFace uiLangFace
9494
-> AriadneConfig
9595
-> ComponentM (IO ())
@@ -169,21 +169,23 @@ initializeEverything MainSettings {..}
169169
initAction :: IO ()
170170
initAction = walletInitAction
171171

172+
postStartupAction :: IO ()
173+
postStartupAction = postInitAction
174+
172175
serviceAction :: IO ()
173176
serviceAction =
174177
raceWithUpdateCheckAction cardanoAction
175178

176179
mainAction :: IO ()
177180
mainAction = do
178181
initAction
179-
withAsync postInitAction $ \postInitActionThread -> do
180-
linkUI postInitActionThread $ msPutBackendErrorToUI uiFace
181182
-- Spawn backend actions in async thread, then run ui action in the main thread
182183
-- This is needed because some UI libraries (Qt) insist on livng in the main thread
183-
withAsync serviceAction $ \serviceThread -> do
184+
withAsync (concurrently postStartupAction serviceAction) $ \serviceThread -> do
184185
-- Make custom link to service thread for UI apps.
185186
-- It is going to call msPutBackendErrorToUI and rethrow exception, if something goes wrong
186187
linkUI serviceThread $ msPutBackendErrorToUI uiFace
188+
logDebug logging "Launching the UI..."
187189
uiAction
188190
return mainAction
189191

0 commit comments

Comments
 (0)