django / asgiref

ASGI specification and utilities
https://asgi.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1.46k stars 207 forks source link

Revert removing of SyncToAsync.get_current_task #454

Closed legau closed 5 months ago

legau commented 5 months ago

SyncToAsync.get_current_task was removed in #367 where it was not documented and introduces regressions in our code base

andrewgodwin commented 5 months ago

This was never a publicly-documented API; may I ask what type of code was relying on it? We can add it back but it's also mostly just dispatching to asyncio.

carltongibson commented 5 months ago

Cc @jthorniley FYI (And if you have any thought...)

legau commented 5 months ago

Hi, this is used in an obscure piece of an internal lib of ours. We are going to replace it by asyncio.current_task, could we make this deprecated for now ?

carltongibson commented 5 months ago

@legau It's probably easiest if you pin to version 3.7.2 whilst you work on the adjustment. That's a one-line requirements change for you, vs quite a lot of disruption to re-add, release, and immediately deprecate the method, which as Andrew notes was undocumented private API anyway.

legau commented 5 months ago

I guess it's easier I'm closing the PR. However I disagree on it being a private method, it is a publicly named method of a documented publicly exposed class.