summaryrefslogtreecommitdiff
path: root/server/Handlers.hs
diff options
context:
space:
mode:
authorstuebinm2022-03-20 19:02:06 +0100
committerstuebinm2022-03-20 19:02:06 +0100
commitf72855ea8ade8f94474618c5dacda8dd30171740 (patch)
tree4f307cd839ade66250ef4e15128976320c2ae7e9 /server/Handlers.hs
parent0032307c5868d56490ac1d968c986f8bab5a637b (diff)
server: keep (one) last good result per repo
(i.e. we want to still have a valid version of the map if new results where introduced)
Diffstat (limited to 'server/Handlers.hs')
-rw-r--r--server/Handlers.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/Handlers.hs b/server/Handlers.hs
index 0e30d2f..987b6df 100644
--- a/server/Handlers.hs
+++ b/server/Handlers.hs
@@ -52,9 +52,9 @@ instance ToJSON MapService where
. mapMaybe worldObject
$ M.elems statuses
where
- worldObject (RemoteRef {..}, job) = case job of
- Linted res rev _ ->
- Just (A.fromText reponame .=
+ worldObject (remote, _current, result) = case result of
+ Just (Linted res rev _) ->
+ Just (A.fromText (reponame remote) .=
M.mapWithKey (mapInfo rev) (dirresultMaps res))
_ -> Nothing
mapInfo rev mappath MapResult { .. } = A.object
@@ -68,8 +68,8 @@ statusImpl :: MVar ServerState -> Text -> Sha1 -> Handler JobStatus
statusImpl state orgslug sha1 = do
status <- liftIO $ getJobStatus state orgslug sha1
case status of
- Just (_,_,jobstatus) -> pure jobstatus
- Nothing -> throwError err404
+ Just (_,_,jobstatus,_) -> pure jobstatus
+ Nothing -> throwError err404
-- | since there are multiple apis that just get state information …
stateImpl
@@ -83,7 +83,7 @@ relintImpl :: TQueue Job -> MVar ServerState -> Text -> Sha1 -> Handler Text
relintImpl queue state orgslug sha1 =
liftIO $ getJobStatus state orgslug sha1 >>= \case
Nothing -> pure "there isn't a job here to restart"
- Just (org, ref, _oldjob) -> do
+ Just (org, ref, _oldjob, _veryoldjob) -> do
atomically $ writeTQueue queue (Job ref org)
pure "hello"
@@ -91,7 +91,7 @@ relintImpl queue state orgslug sha1 =
realtimeImpl :: MVar ServerState -> Text -> Sha1 -> PendingConnection -> Handler ()
realtimeImpl state orgslug sha1 pending =
liftIO (getJobStatus state orgslug sha1) >>= \case
- Just (_org, _ref, Linted _ _ (_, realtime)) -> do
+ Just (_org, _ref, Linted _ _ (_, realtime), _) -> do
conn <- liftIO $ acceptRequest pending
incoming <- atomically $ dupTChan realtime
liftIO $ withPingThread conn 30 pass $ forever $ do