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

Fix async refresh #342

Merged
merged 4 commits into from
Jul 26, 2022
Merged

Fix async refresh #342

merged 4 commits into from
Jul 26, 2022

Conversation

KundaPanda
Copy link
Owner

Async refresh was currently somehow broken. This fixes it and adds explicit async resolvers for clarity.

#337

@KundaPanda KundaPanda self-assigned this Jul 26, 2022
@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #342 (354544a) into master (46072d7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #342   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          32       32           
  Lines        1082     1099   +17     
  Branches      180      185    +5     
=======================================
+ Hits         1080     1097   +17     
  Partials        2        2           
Impacted Files Coverage Δ
strawberry_django_jwt/mixins.py 100.00% <100.00%> (ø)
strawberry_django_jwt/mutations.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46072d7...354544a. Read the comment docs.

@@ -39,5 +39,13 @@ class Mutation:
delete_cookie = jwt_mutations.DeleteJSONWebTokenCookie.delete_cookie


schema = Schema(query=Query, mutation=Mutation, extensions=[AsyncJSONWebTokenMiddleware])
@strawberry.type
Copy link

@nrbnlulu nrbnlulu Jul 26, 2022

Choose a reason for hiding this comment

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

Is that required (RefreshAsync) or just for readability?

Copy link
Owner Author

Choose a reason for hiding this comment

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

RefreshAsync will be required, the refresh token db access is done inside the resolver so it must be wrapped in sync_to_async. Obtain handles this in decorators where it is already async safe.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Other are just for consistency

@KundaPanda KundaPanda merged commit 25573ec into master Jul 26, 2022
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.

None yet

2 participants