introduce mutex to avoid multiple token refresh when using threads.
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import threading
|
||||
|
||||
import requests
|
||||
|
||||
from mdrsclient.cache import CacheFile
|
||||
@ -8,12 +10,14 @@ from mdrsclient.models import Laboratories, Token, User
|
||||
class MDRSConnection:
|
||||
url: str
|
||||
session: requests.Session
|
||||
lock: threading.Lock
|
||||
__cache: CacheFile
|
||||
|
||||
def __init__(self, remote: str, url: str) -> None:
|
||||
super().__init__()
|
||||
self.url = url
|
||||
self.session = requests.Session()
|
||||
self.lock = threading.Lock()
|
||||
self.__cache = CacheFile(remote)
|
||||
self.__prepare_headers()
|
||||
|
||||
|
Reference in New Issue
Block a user