UserStore: Add migration logic and migration interpreter - #5324
UserStore: Add migration logic and migration interpreter#5324akshaymankar wants to merge 24 commits into
Conversation
3e94d0b to
4dcb50c
Compare
c109be7 to
acf0807
Compare
51dd43c to
1f3a077
Compare
| newScimUser <- | ||
| if shouldCreateRichInfo | ||
| then | ||
| -- TODO: Actually generate rich info |
There was a problem hiding this comment.
if it is intentional, I prefer FUTUREWORK
There was a problem hiding this comment.
I'll try to actually implement it before merging this, I'm not really done with making the tests more robust yet.
| -- lift $ Log.warn $ Log.msg (Log.val "activation will be verified") . Log.field "key" (show k) . Log.field "code" (show c) | ||
| (emailKey, mUser) <- wrapClientE (verifyCode k c) | ||
| -- lift $ Log.warn $ Log.msg (Log.val "activation verified") . Log.field "key" (show k) . Log.field "code" (show c) |
There was a problem hiding this comment.
Yeah this stuff needs to go, I'll clean it up before asking for next review.
| unless (userStatus a == Active) $ do | ||
| lift $ | ||
| Log.warn $ | ||
| Log.msg (Log.val "-------> User is not active") |
There was a problem hiding this comment.
Can you use a more formal message?
| import Polysemy.Resource (Resource) | ||
| import Polysemy.Time | ||
| import Polysemy.TinyLog (TinyLog, warn) | ||
| import System.Logger.Message qualified as Log |
| scimUsersWithRichInfo <- Concurrently $ createScimUsers domain n True True | ||
| scimUsersWithoutRichInfo <- Concurrently $ createScimUsers domain n True True |
There was a problem hiding this comment.
Shouldn't bools be different?
| mkUserRowPG id_ cass@UserRowCass {..} isHandleClaimed richInfo = run . runError $ do | ||
| pgName <- note UserHasNoName cass.name | ||
| pgActivated <- note UserHasNoActivated cass.activated | ||
| createdAt <- note UserHasNoActivated $ writetimeToUTC <$> cass.activatedWriteTime |
There was a problem hiding this comment.
Something is odd here, IIRC activatedWriteTime is the last write time.
| ) => | ||
| Duration -> Prometheus.Counter -> Prometheus.Vector Text Prometheus.Histogram -> UserId -> Sem r () | ||
| migrateUser migTimeout migCounter migDuration uid = | ||
| withExclusiveMigrationLockAndTimeout migTimeout migDuration [uid] $ do |
There was a problem hiding this comment.
Is it fine to have a global lock?
There was a problem hiding this comment.
What do you mean global?
There was a problem hiding this comment.
For all users instead of one by one.
brig: use the dummy implementation
local-setup: Increase postgresql max connections (CI setup already has more)
Deletes are really slow
06b20b3 to
bb68426
Compare
Checklist
changelog.d