-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/team events #35
Conversation
rsp <- Data.deleteTeam tid | ||
when ((view teamBinding . Data.tdTeam <$> team) == Just Binding) $ | ||
journal $ Journal.teamDelete tid | ||
return rsp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we reverse this, i.e., deleteTeam
should probably be done after the journaling as that'd guarantee that we journal the event at least once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense in this case.
|
||
teamCreate :: TeamId -> UserId -> IO TeamEvent | ||
teamCreate tid uid = do | ||
now <- utcTimeToInt64 <$> liftIO getCurrentTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of requiring a new library, how about using utcTimeToPOSIXSeconds which is part of time?
> n <- getCurrentTime
> n
2017-07-26 12:52:28.373924 UTC
> utcTimeToInt64 n
1501073548
> round (utcTimeToPOSIXSeconds n) :: Int64
1501073548
rsp <- addTeamMemberInternal tid Nothing Nothing nmem mems | ||
let membs = nmem^.ntmNewTeamMember : mems | ||
let bUsers = view userId <$> filter (`hasPermission` SetBilling) membs | ||
journal $ Journal.teamUpdate tid (fromIntegral $ length membs) bUsers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that
let membs = filter (\u -> u^.userId /= remove) mems
let bUsers = view userId <$> filter (`hasPermission` SetBilling) membs
$ Journal.teamUpdate tid (fromIntegral $ length membs) bUsers
is a recurring pattern, with only slight variation on how membs
is constructed. Can we refactor that?
mEnv <- view aEnv | ||
for_ mEnv $ \e -> do | ||
event <- liftIO ev | ||
void $ Aws.execute e (Aws.enqueue event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need this void
here
either (throwM . GeneralError) (const (return ())) res | ||
where | ||
event = decodeLatin1 $ B64.encode $ encodeMessage e | ||
req url = SQS.sendMessage url event & SQS.smMessageGroupId .~ Just "team.events" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just nitpicking here but should we define this somewhere else since it should be used by consumers too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you referring to the MessageGroupId
? This is only relevant when sending to a FIFO queue, consumers don't need to know about it:
Receiving Messages
You can't request to receive messages with a specific message group ID.
3d8d59e
to
827858c
Compare
Introduces journaling via AWS SQS for team events (create, update, delete). * Team deletions become soft deletes (to allow for eventual consistency on the journal consumer side: a cassandra table scan allows for re-creating create/delete events) * types-common-journal depends on `protoc` at compile time for protobuf code generation. * Journaling in galley is optional at run time (via optional `---team-events-queue-name` and `--aws-region` params) and at integration test time (via an optional `GALLEY_SQS_TEAM_EVENTS` environment variable) to allow galley to function without SQS. * integration tests consume SQS events, making them slower (from ~90s to ~110s) (to be improved)
827858c
to
621b5fb
Compare
* ListResponse is 1-indexed, not 0-indexed * implement patch in terms of get and put * Implements patch _only_ for userName, displayName, externalId * Add Azure acceptance test Co-authored-by: fisx <mf@zerobuzz.net>
…s components (#35) * add a first scenario explaining cert renewal for a 3-master K8s v1.14 setup installed with Kubespray * add additional structure to reflect (fingers crossed) future k8s content * typo * Minor changes, add one paragraph Co-authored-by: jschaul <jschaul@users.noreply.github.com>
Introduces journaling via AWS SQS for team events (create, update, delete).
protoc
at compile time for protobuf code generation.---team-events-queue-name
and--aws-region
params) and at integration test time (via an optionalGALLEY_SQS_TEAM_EVENTS
environment variable) to allow galley to function without SQS.