Skip to content

Commit 505de54

Browse files
committed
...
1 parent 1bc6cf9 commit 505de54

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

libs/wire-api/src/Wire/API/Team/Feature.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module Wire.API.Team.Feature
3535
setStatus,
3636
setLockStatus,
3737
setConfig,
38+
setWsTTL,
3839
WithStatusPatch,
3940
wspStatus,
4041
wspLockStatus,
@@ -214,6 +215,9 @@ setLockStatus ls (WithStatusBase s _ c ttl) = WithStatusBase s (Identity ls) c t
214215
setConfig :: cfg -> WithStatus cfg -> WithStatus cfg
215216
setConfig c (WithStatusBase s ls _ ttl) = WithStatusBase s ls (Identity c) ttl
216217

218+
setWsTTL :: FeatureTTL -> WithStatus cfg -> WithStatus cfg
219+
setWsTTL ttl (WithStatusBase s ls c _) = WithStatusBase s ls c (Identity ttl)
220+
217221
type WithStatus (cfg :: *) = WithStatusBase Identity cfg
218222

219223
deriving instance (Eq cfg) => Eq (WithStatus cfg)

services/galley/src/Galley/Cassandra/TeamFeatures.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ getTrivialConfigC ::
7272
m (Maybe (WithStatusNoLock cfg))
7373
getTrivialConfigC statusCol tid = do
7474
let q = query1 select (params LocalQuorum (Identity tid))
75-
mFeatureStatus <- (>>= runIdentity) <$> retry x1 q
76-
pure $ case mFeatureStatus of
77-
Nothing -> Nothing
78-
Just status -> Just . forgetLock $ setStatus status defFeatureStatus
75+
row <- retry x1 q
76+
pure $ row <&> \(status, ttl) -> forgetLock . setStatus status . setWsTTL ttl $ defFeatureStatus
7977
where
80-
select :: PrepQuery R (Identity TeamId) (Identity (Maybe FeatureStatus))
78+
select :: PrepQuery R (Identity TeamId) (FeatureStatus, FeatureTTL)
8179
select =
8280
fromString $
8381
"select "
8482
<> statusCol
83+
<> ", ttl("
84+
<> statusCol
85+
<> ")"
8586
<> " from team_features where team_id = ?"
8687

8788
setFeatureStatusC ::

0 commit comments

Comments
 (0)