diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-14 17:01:21 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-14 17:01:21 -0500 |
| commit | bffdc005275bf74cde864dabcfafec497dcf0013 (patch) | |
| tree | c4ac67eccb22d23458959d2643c07eb3981d204f /Omni/Log/Concurrent.hs | |
| parent | bf608be61e97bab08e3f26f249762e63630549b4 (diff) | |
Implement concurrent analysis with [+] state indicator
- Add Analyzing state to BuildState enum - Refactor from sequential
foldM analyze to concurrent analyzeAll - Initialize all lines with
[+] during analysis phase - Update to [...] (Pending) after each
analysis completes - Uses mapConcurrentlyBounded with concurrency of
8 for analysis - Remove Log.info from analyzeOne (now handled by line
state) - Analysis now runs in parallel, improving efficiency - Flow:
[+] analyzing → [...] pending → [~] building → [✓]/[x] complete
Diffstat (limited to 'Omni/Log/Concurrent.hs')
| -rw-r--r-- | Omni/Log/Concurrent.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Omni/Log/Concurrent.hs b/Omni/Log/Concurrent.hs index b064190..1a82507 100644 --- a/Omni/Log/Concurrent.hs +++ b/Omni/Log/Concurrent.hs @@ -26,7 +26,7 @@ import qualified System.Environment as Env import qualified System.IO as IO import System.IO.Unsafe (unsafePerformIO) -data BuildState = Pending | Building | Success | Failed +data BuildState = Analyzing | Pending | Building | Success | Failed deriving (Eq, Show) data LineManager = LineManager @@ -92,7 +92,7 @@ initializeLines LineManager {..} = ANSI.hSetCursorColumn IO.stderr 0 ANSI.hClearLine IO.stderr let nsText = Text.pack (Namespace.toPath ns) - IO.hPutStrLn IO.stderr (Text.unpack <| "[…] " <> nsText) + IO.hPutStrLn IO.stderr (Text.unpack <| "[+] " <> nsText) IO.hFlush IO.stderr updateLine :: Namespace -> Text -> IO () @@ -146,6 +146,8 @@ updateLineState ns buildState = do Rainbow.hPutChunks IO.stderr [fore green <| chunk <| "[✓] " <> nsText] Failed -> Rainbow.hPutChunks IO.stderr [fore red <| chunk <| "[x] " <> nsText] + Analyzing -> + IO.hPutStr IO.stderr (Text.unpack <| "[+] " <> nsText) Pending -> IO.hPutStr IO.stderr (Text.unpack <| "[…] " <> nsText) Building -> |
