Skip to content

Use Django async-native APIs where possible #2089

Open
@bigfootjon

Description

@bigfootjon

As discussed on the Django forumns Carlton pointed out that one area we'd like to invest in in is Channels support for the new async functionality that has been added over the last several releases (refer to the above thread for details).

I've scanned the channels repo by searching for database_sync_to_async and observed a few areas that could benefit from these new APIs:

  1. Sessions
  2. Auth

(this list is the same as Carlton pointed out on that thread, something tells me he might be some kind of expert!)

The other calls to database_sync_to_async are from wrappers for intentionally sync code, or tests (neither of which are pertinent).

I'd like to propose using these native APIs. The one hitch I see is that these features are too new to be used presently:

  1. async sessions has not yet been released (scheduled for 5.1)
  2. async auth was released in 5.0

Considering that Channels currently supports 4.2 (and definitely doesn't yet support unreleased 5.1) we might have to do some feature-checking or wait until Channels bumps its minimum supported version. Should I start now with writing some polyfills/feature-checks or set this aside until minimum versions are bumped?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions