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

docs(examples/asgilook): update aioredis version to 2.0 #1987

Merged
merged 8 commits into from
Dec 6, 2021

Conversation

the-bets
Copy link
Contributor

@the-bets the-bets commented Nov 5, 2021

Summary of Changes

Update aioredis to version 2.0, the impact of which is found in the asgilook examples. Apply necessary code and API changes as well as update asgilook tutorial.

Both tools/mintest.sh and tox --recreate -e asgilook pass with these updates. Docs (for the tutorial) were also successfully built and changes correctly shown.

Related Issues

fixes #1938

Pull Request Checklist

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once; it will save you a few review cycles!

If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing to do.

  • Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • Added tests for changed code.
  • Prefixed code comments with GitHub nick and an appropriate prefix.
  • Coding style is consistent with the rest of the framework.
  • Updated documentation for changed code.
    • Added docstrings for any new classes, functions, or modules.
    • Updated docstrings for any modifications to existing code.
    • Updated both WSGI and ASGI docs (where applicable).
    • Added references to new classes, functions, or modules to the relevant RST file under docs/.
    • Updated all relevant supporting documentation files under docs/.
    • A copyright notice is included at the top of any new modules (using your own name or the name of your organization).
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • Changes (and possible deprecations) have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst. (Run towncrier --draft to ensure it renders correctly.)

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

PR template inspired by the attrs project.

Upgrade aioredis library to 2.0

Co-authored-by: Mihai Todor <todormihai@gmail>
@codecov
Copy link

codecov bot commented Nov 6, 2021

Codecov Report

Merging #1987 (374571c) into master (9786798) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1987   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           63        63           
  Lines         6676      6676           
  Branches      1239      1239           
=========================================
  Hits          6676      6676           

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 9786798...374571c. Read the comment docs.

@vytas7 vytas7 changed the title refactor $examples/asgilook: update aioredis version to 2.0 refactor(examples/asgilook): update aioredis version to 2.0 Nov 6, 2021
Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

This looks really good, thanks!

If possible, I would like to keep an example demonstrating the use of ASGI process_startup, IIRC we were even linking to that example from FAQ (or were going to).
I understand that aioredis has changed design so that pool initialization is now a synchronous function. But could we maybe invent a use case for async process_startup (or alternatively process_shutdown)?

(See also #1981 & #1982)

@CaselIT
Copy link
Member

CaselIT commented Nov 6, 2021

But could we maybe invent a use case for async process_startup (or alternatively process_shutdown)?

Maybe we could ping the server in process_startup using await self._redis.ping() and close the pool in process_shutdown by doing await self._redis.connection_pool.disconnect()?

@vytas7
Copy link
Member

vytas7 commented Nov 6, 2021

Yeah that sounds great @CaselIT ! That makes sense because as I understand aioredis.from_url(...) just instantiates an object, you can provide any URL there, even if the referenced server is down or broken.

I think process_startup is enough though 😅

@the-bets
Copy link
Contributor Author

the-bets commented Nov 8, 2021

Sounds good! Thanks for the review, we'll plan on adding in that process_startup/process_shutdown example this week.

@vytas7 vytas7 changed the title refactor(examples/asgilook): update aioredis version to 2.0 docs(examples/asgilook): update aioredis version to 2.0 Nov 8, 2021
@vytas7
Copy link
Member

vytas7 commented Nov 24, 2021

Hi again @the-bets , just checking if you are going to have an opportunity to work on that process_startup example?
Otherwise I'm thinking we could add this ourselves in a followup PR, as your changeset seems to be really well polished as-is, and maybe we don't need to delay merging just because of the lack of that example.

@the-bets
Copy link
Contributor Author

Hi again @the-bets , just checking if you are going to have an opportunity to work on that process_startup example?

Otherwise I'm thinking we could add this ourselves in a followup PR, as your changeset seems to be really well polished as-is, and maybe we don't need to delay merging just because of the lack of that example.

Hello again! Thanks for checking in. Mihai and I both got busy with work and life since the last time we talked on this PR. Neither of us have gotten to writing that example yet, and with this being a travel/holiday week for 1/2 of us, we probably won't get to it soon. We do not mind this PR being merged as-is for the time being.

If you want to add the example yourselves, that's also fine with us! We are still down to add it, but again likely won't get to it this week.

@vytas7
Copy link
Member

vytas7 commented Nov 25, 2021

Thanks for the update!
It's not that urgent, so if you're still committed to it, we can keep this open until we are approaching a release.

the-bets and others added 6 commits December 5, 2021 16:32
Adds a simple example of using ASGI `process_startup`. (This process is now asynchronous.) As per the discussion above, the example pings the server in `process_startup` and closes the pool in `process_shutdown`. Mihai was able to test it by following the tutorial's test app startup process.

Co-authored-by: Mihai Todor <todormihai@gmail.com>
Copy link
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

This LGTM now 💯
(I took the liberty of fixing a couple of trivial/cosmetic issues to get the CI to pass.)

Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

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

Thanks!

@vytas7 vytas7 merged commit 9b7cebb into falconry:master Dec 6, 2021
@the-bets
Copy link
Contributor Author

the-bets commented Dec 7, 2021

Thank you @vytas7 and @CaselIT for the input, patience, and quick merge!

@vytas7 vytas7 mentioned this pull request Jan 20, 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.

Update asgi look examples to use aioredis 2
3 participants