Skip to content
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

PLATFORM-9039: webhooks reliability #98

Merged
merged 4 commits into from
Feb 19, 2024

Conversation

korzepadawid
Copy link

Related issue(s)

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@korzepadawid korzepadawid changed the base branch from fandom_master_1_0_0 to PLATFORM-8899-CR February 14, 2024 08:11
@korzepadawid korzepadawid changed the title Platform 9039 webhooks reliability PLATFORM-9039: webhooks reliability Feb 15, 2024
@korzepadawid korzepadawid force-pushed the PLATFORM-9039-webhooks-reliability branch from b9fdd63 to 744cbfd Compare February 15, 2024 15:04
@korzepadawid korzepadawid marked this pull request as ready for review February 15, 2024 15:05
m.rc[name] = rc
m.rwl.Unlock()
Copy link
Author

Choose a reason for hiding this comment

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

there was a data race before

Copy link
Author

Choose a reason for hiding this comment

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

a map in Go is not thread-safe

Copy link
Member

Choose a reason for hiding this comment

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

nit: Could we use https://pkg.go.dev/sync#Map instead of manual synchronization?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you're right.

@@ -540,17 +538,28 @@ func (e *WebHook) execute(ctx context.Context, data *templateContext) error {
return nil
}

func parseWebhookResponse(resp *http.Response, id *identity.Identity) (err error) {
func (e *WebHook) parseWebhookResponse(resp *http.Response, id *identity.Identity) (err error) {
Copy link
Author

Choose a reason for hiding this comment

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

let's try to push it to the upstream

Copy link
Author

@korzepadawid korzepadawid Feb 15, 2024

Choose a reason for hiding this comment

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

otherwise, we won't have an access to the logger

Copy link
Author

@korzepadawid korzepadawid Feb 15, 2024

Choose a reason for hiding this comment

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

the logger is only available through e.deps

@@ -934,8 +936,8 @@ func TestWebHooks(t *testing.T) {
// error.

var wg sync.WaitGroup
wg.Add(3) // HTTP client does 3 attempts
Copy link
Author

Choose a reason for hiding this comment

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

@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (PLATFORM-8899-CR@976097c). Click here to learn what that means.

❗ Current head 2e6cb45 differs from pull request most recent head 037e42e. Consider uploading reports for the commit 037e42e to get more accurate results

Files Patch % Lines
selfservice/hook/web_hook.go 58.33% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##             PLATFORM-8899-CR      #98   +/-   ##
===================================================
  Coverage                    ?   76.58%           
===================================================
  Files                       ?      331           
  Lines                       ?    22055           
  Branches                    ?        0           
===================================================
  Hits                        ?    16891           
  Misses                      ?     3867           
  Partials                    ?     1297           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// 204: emptyResponse
// 404: jsonError
// 500: jsonError
func (h *Handler) deleteMultifactorCredential(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
Copy link
Author

Choose a reason for hiding this comment

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

@adpaste adpaste merged commit 3b90cf7 into PLATFORM-8899-CR Feb 19, 2024
15 checks passed
@adpaste adpaste deleted the PLATFORM-9039-webhooks-reliability branch February 19, 2024 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants