core: redesign request middleware with django latest design and better use of threading

2 jobs for deletion_logs in 37 minutes and 38 seconds (queued for 3 seconds)
latest
Status Job ID Name Coverage
  Test
passed #2938
black

00:02:43

passed #2937
test

00:37:38

63.0%