Changes between Initial Version and Version 1 of Ticket #31920, comment 8


Ignore:
Timestamp:
Oct 2, 2020, 1:23:00 PM (4 years ago)
Author:
Ben Lomax

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31920, comment 8

    initial v1  
    33> This is tricky, as the middleware doesn't know if the view below it is sync or async. There's a variety of solutions to this - a setting to always greedily load it, a nice-ish async-compatible function on user/SimpleLazyObject that loads it, trying to escape to the async loop using greenlets - but I'm not sure which one I prefer right now.
    44
    5 Just checking to see if the current state of Django lent itself to any of the proposed ideas here (setting to greedily load / async-compatible function / greenlets / something else)? I'd be keen to have a crack at this but wanted to see what the best approach might be before doing a deep dive on a badly chosen one.
     5Just checking to see if the current state of Django lent itself to any of the proposed ideas here (setting to greedily load / async-compatible function / greenlets / something else)? I'd be keen to have a crack at this but wanted to see what the best approach might be before doing a deep dive on a badly chosen one. Given the above choices I guess my next questions would be:
     6
     71. For the greedy load, I would imagine the greedy load would be for all of the middleware? I think `AuthenticationMiddleware` is the only one that lazy loads an object (although `GZipMiddleware` has a `_lazy_re_compile` which I've not wrapped my head around yet to know if that would need to be updated too).
     8
     92. The user / `SimpleLazyObject` async function sounds like it might potentially be the neatest, but I don't really understand how that could be implemented. Do you have any existing examples that so similar things (or even just a pointer of how I might approach this)?
     10
     113. I've not encountered "greenlets" before. Are you referencing this library? https://github.com/python-greenlet/greenlet
Back to Top