fix: return cached responses from idempotent decorator
This commit is contained in:
parent
fcfe76bb6d
commit
f17d9aec5b
|
|
@ -6,6 +6,7 @@ import hashlib
|
|||
import json
|
||||
from django.core.cache import cache
|
||||
from rest_framework.exceptions import ParseError
|
||||
from rest_framework.response import Response
|
||||
|
||||
myLogger = logging.getLogger('log')
|
||||
|
||||
|
|
@ -48,6 +49,6 @@ def idempotent(seconds=4):
|
|||
return real_func
|
||||
elif hash_v_e == 'o': # 说明请求正在处理
|
||||
raise ParseError(f'请求忽略,请{seconds}秒后重试')
|
||||
return hash_v_e
|
||||
return Response(hash_v_e)
|
||||
return wrapper
|
||||
return decorate
|
||||
|
|
|
|||
Loading…
Reference in New Issue