Skip to content

Commit 95cba05

Browse files
committed
added pool size support
1 parent 65cac6d commit 95cba05

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
sampler=ProbabilitySampler(rate=1.0),
2424
)
2525

26+
# Get Pool Size
27+
if 'POOL_SIZE' in os.environ:
28+
pool_size = int(os.environ['POOL_SIZE'])
29+
else:
30+
pool_size = 10
31+
2632
# Setup Flask Restful framework
2733
api = Api(app)
2834
parser = reqparse.RequestParser()
@@ -76,7 +82,7 @@ def is_retriable(self, value):
7682
def __getConnection(self):
7783
self.__lock.acquire()
7884
idx = self.__conn_index + 1
79-
if idx > 9: idx = 0
85+
if idx > pool_size: idx = 1
8086
self.__conn_index = idx
8187
self.__lock.release()
8288

0 commit comments

Comments
 (0)