misc: adopt hobo way of generating the request_id (#47023)

This commit is contained in:
Benjamin Dauvergne 2020-09-25 13:36:40 +02:00
parent 85c85b2595
commit e4cc914c86
1 changed files with 1 additions and 6 deletions

View File

@ -77,12 +77,7 @@ class RequestIdMiddleware(MiddlewareMixin):
if request_id_header and request.META.get(request_id_header):
request.request_id = request.META[request_id_header]
else:
# Use Mersennes Twister rng, no need for a cryptographic grade
# rng in this case
random_id = random.getrandbits(32)
request.request_id = force_text(
hexlify(struct.pack('I', random_id)),
encoding='ascii')
request.request_id = 'r:' + hex(id(request))[2:].upper()
class StoreRequestMiddleware(MiddlewareMixin):