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

internal: Use loop instead of recursion in NewAPIController #10745

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

RMTT
Copy link
Contributor

@RMTT RMTT commented Aug 3, 2024

Details

Use loop instead of recursion in NewAPIController.

Golang has no tail call optimization now, so the recursion return NewAPIController(akURL, token) will cause the stack too deep when OutpostsApi failed for a long time.


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@RMTT RMTT requested a review from a team as a code owner August 3, 2024 07:19
Copy link

netlify bot commented Aug 3, 2024

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit 7c7be5f
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/66adda07199cd20008a95681

Copy link

netlify bot commented Aug 3, 2024

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 7c7be5f
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/66adda076c5d3f00086538e3
😎 Deploy Preview https://deploy-preview-10745--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.53%. Comparing base (122cf4f) to head (7c7be5f).
Report is 175 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10745       /-   ##
==========================================
  Coverage   92.51%   92.53%    0.02%     
==========================================
  Files         720      721        1     
  Lines       35254    35359      105     
==========================================
  Hits        32615    32721      106     
  Misses       2639     2638       -1     
Flag Coverage Δ
e2e 49.62% <ø> (-0.01%) ⬇️
integration 25.36% <ø> ( <0.01%) ⬆️
unit 90.04% <ø> ( 0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@BeryJu BeryJu left a comment

Choose a reason for hiding this comment

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

While this should be fine, I'm not 100% sure if this works as intended in all cases as there might be some other state that the current implementation relies on being reset

@RMTT
Copy link
Contributor Author

RMTT commented Aug 16, 2024

While this should be fine, I'm not 100% sure if this works as intended in all cases as there might be some other state that the current implementation relies on being reset

Seems the parameters are same in every recursion, so i think it's probably ok.

@BeryJu BeryJu changed the title Use loop instead of recursion in NewAPIController internal: Use loop instead of recursion in NewAPIController Aug 16, 2024
@BeryJu BeryJu merged commit d75cdfe into goauthentik:main Aug 16, 2024
68 checks passed
@RMTT RMTT deleted the recursion branch August 18, 2024 08:39
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.

2 participants