We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f87ab3 commit d2b9ef8Copy full SHA for d2b9ef8
app.py
@@ -4,7 +4,7 @@
4
from flask_restful import reqparse, abort, Api, Resource
5
import json
6
import pyodbc
7
-import threading
+from threading import Lock
8
9
# Initialize Flask
10
app = Flask(__name__)
@@ -21,9 +21,15 @@
21
conn = pyodbc.connect(os.environ['SQLAZURECONNSTR_WWIF'])
22
conn_list.append(conn)
23
24
+lock = Lock()
25
+
26
def getConnection():
27
global conn_index
28
29
+ lock.acquire()
30
conn_index += 1
31
+ lock.release()
32
33
if conn_index > 9:
34
conn_index = 0
35
return conn_list[conn_index]
0 commit comments