From 2bbd2f8b692dd952903a9f1527f2779a916118ab Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Wed, 13 Dec 2023 03:47:14 +0100 Subject: chore: uncache large issue fields --- app/IssueEvent.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/IssueEvent.hs') diff --git a/app/IssueEvent.hs b/app/IssueEvent.hs index c82dba5..0c641ad 100644 --- a/app/IssueEvent.hs +++ b/app/IssueEvent.hs @@ -5,6 +5,7 @@ module IssueEvent ) where +import Control.Monad (join) import Data.Binary (Binary (..)) import Data.Function ((&)) import Data.Text qualified as T @@ -42,9 +43,9 @@ data IssueEvent deriving (Show, Generic, Binary) instance HasField "patch" IssueEvent (IO Patch) where - getField (IssueCreated {..}) = diff "" issue.rawText - getField (IssueChanged {..}) = diff oldIssue.rawText issue.rawText - getField (IssueDeleted {..}) = diff issue.rawText "" + getField (IssueCreated {..}) = join $ (diff "" <$> issue.rawText) + getField (IssueChanged {..}) = join $ (diff <$> oldIssue.rawText <*> issue.rawText) + getField (IssueDeleted {..}) = join $ (flip diff "" <$> issue.rawText) diff :: T.Text -> T.Text -> IO A.Patch diff old new = withSystemTempDirectory "diff" $ \tmp -> do -- cgit v1.2.3