From df94847946584d1944cc35901e8b044a2d71f0ee Mon Sep 17 00:00:00 2001 From: "phil@volguine.com" Date: Fri, 13 Oct 2023 20:47:00 +0000 Subject: [PATCH] Expect board might have no threads --- backfill.sh | 2 +- src/Backfill.hs | 2 +- src/JSONParsing.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backfill.sh b/backfill.sh index f79aa5b..9d55407 100755 --- a/backfill.sh +++ b/backfill.sh @@ -37,7 +37,7 @@ while IFS= read -r BACKUP_PATH; do sed -e 's|\("backup_read_root": \)".*"|\1"'"$BACKUP_PATH"'"|' "$SETTINGS_FILE" > "temp_$SETTINGS_FILE" # Run the Haskell program with the updated settings file - $PROG +RTS -N2 -RTS "temp_$SETTINGS_FILE" + time $PROG +RTS -N2 -RTS "temp_$SETTINGS_FILE" done < "$PATHS_FILE" # Optionally, remove the temporary settings file diff --git a/src/Backfill.hs b/src/Backfill.hs index 2b78489..aaddce0 100644 --- a/src/Backfill.hs +++ b/src/Backfill.hs @@ -226,7 +226,7 @@ processBoard settings board = do case result of Right catalogs -> do - let threads_on_board = concatMap threads catalogs + let threads_on_board = concatMap ((maybe [] id) . threads) catalogs all_threads_for_board :: [ Threads.Thread ] <- ensureThreads settings board threads_on_board diff --git a/src/JSONParsing.hs b/src/JSONParsing.hs index fe981ce..cf3bf19 100644 --- a/src/JSONParsing.hs +++ b/src/JSONParsing.hs @@ -42,7 +42,7 @@ instance FromJSON Thread --instance ToJSON Thread data Catalog = Catalog - { threads :: [Thread] + { threads :: Maybe [Thread] , page :: Int } deriving (Show, Generic)