File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
libs/wire-api/src/Wire/API/Team
services/galley/src/Galley/Cassandra Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ module Wire.API.Team.Feature
35
35
setStatus ,
36
36
setLockStatus ,
37
37
setConfig ,
38
+ setWsTTL ,
38
39
WithStatusPatch ,
39
40
wspStatus ,
40
41
wspLockStatus ,
@@ -214,6 +215,9 @@ setLockStatus ls (WithStatusBase s _ c ttl) = WithStatusBase s (Identity ls) c t
214
215
setConfig :: cfg -> WithStatus cfg -> WithStatus cfg
215
216
setConfig c (WithStatusBase s ls _ ttl) = WithStatusBase s ls (Identity c) ttl
216
217
218
+ setWsTTL :: FeatureTTL -> WithStatus cfg -> WithStatus cfg
219
+ setWsTTL ttl (WithStatusBase s ls c _) = WithStatusBase s ls c (Identity ttl)
220
+
217
221
type WithStatus (cfg :: * ) = WithStatusBase Identity cfg
218
222
219
223
deriving instance (Eq cfg ) => Eq (WithStatus cfg )
Original file line number Diff line number Diff line change @@ -72,16 +72,17 @@ getTrivialConfigC ::
72
72
m (Maybe (WithStatusNoLock cfg ))
73
73
getTrivialConfigC statusCol tid = do
74
74
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
79
77
where
80
- select :: PrepQuery R (Identity TeamId ) (Identity ( Maybe FeatureStatus ) )
78
+ select :: PrepQuery R (Identity TeamId ) (FeatureStatus , FeatureTTL )
81
79
select =
82
80
fromString $
83
81
" select "
84
82
<> statusCol
83
+ <> " , ttl("
84
+ <> statusCol
85
+ <> " )"
85
86
<> " from team_features where team_id = ?"
86
87
87
88
setFeatureStatusC ::
You can’t perform that action at this time.
0 commit comments