Skip to content

Use CompareAndSwap for OktaAssignments instead of lock.#24727

Merged
mdwn merged 4 commits intomasterfrom
mike.wilson/okta-use-compare-and-swap
Apr 18, 2023
Merged

Use CompareAndSwap for OktaAssignments instead of lock.#24727
mdwn merged 4 commits intomasterfrom
mike.wilson/okta-use-compare-and-swap

Conversation

@mdwn
Copy link
Copy Markdown
Contributor

@mdwn mdwn commented Apr 18, 2023

CompareAndSwap should be used for the OktaAssignment updates instead of a lock, as it's lighter wait and fits the intended problem better.

CompareAndSwap should be used for the OktaAssignment updates instead of a
lock, as it's lighter wait and fits the intended problem better.
var previousAssignment types.OktaAssignment
err := o.assignmentSvc.UpdateAndSwapResource(ctx, name, func(assignment types.OktaAssignment) error {
previousAssignment = assignment.Copy()
for _, action := range assignment.GetActions() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does GetActions return a mutable slice, or do we need to then do an assignment.SetActions after modifying the actions' statuses?

Same goes for UpdateOktaAssignment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does return a mutable slice.

Comment thread lib/services/local/okta.go Outdated
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from jakule April 18, 2023 15:38
@mdwn mdwn added this pull request to the merge queue Apr 18, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 18, 2023
@mdwn mdwn added this pull request to the merge queue Apr 18, 2023
Merged via the queue into master with commit 4eecd8b Apr 18, 2023
@mdwn mdwn deleted the mike.wilson/okta-use-compare-and-swap branch April 18, 2023 18:03
@public-teleport-github-review-bot
Copy link
Copy Markdown

@mdwn See the table below for backport results.

Branch Result
branch/v12 Create PR
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants