Spaces:
Running
on
Zero
Running
on
Zero
bug fix
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ def update_queue_status(message):
|
|
59 |
|
60 |
def process_task(task):
|
61 |
try:
|
62 |
-
client_id = request.
|
63 |
task.is_processing = True
|
64 |
# ファイルデータをPIL Imageに変換
|
65 |
image = Image.open(io.BytesIO(task.file_data))
|
@@ -118,14 +118,14 @@ connected_clients = 0
|
|
118 |
tasks_per_client = {}
|
119 |
@socketio.on('connect')
|
120 |
def handle_connect(auth):
|
121 |
-
client_id = request.
|
122 |
join_room(client_id) # クライアントを自身のルームに入れる
|
123 |
global connected_clients
|
124 |
connected_clients += 1
|
125 |
|
126 |
@socketio.on('disconnect')
|
127 |
def handle_disconnect():
|
128 |
-
client_id = request.
|
129 |
leave_room(client_id) # クライアントをルームから出す
|
130 |
global connected_clients
|
131 |
connected_clients -= 1
|
@@ -148,7 +148,7 @@ def submit_task():
|
|
148 |
|
149 |
# クライアントIPアドレスを取得
|
150 |
client_ip = get_remote_address()
|
151 |
-
client_id = request.
|
152 |
|
153 |
# 同一IPからの同時タスク数を制限
|
154 |
if tasks_per_client.get(client_ip, 0) >= 2:
|
|
|
59 |
|
60 |
def process_task(task):
|
61 |
try:
|
62 |
+
client_id = request.sid
|
63 |
task.is_processing = True
|
64 |
# ファイルデータをPIL Imageに変換
|
65 |
image = Image.open(io.BytesIO(task.file_data))
|
|
|
118 |
tasks_per_client = {}
|
119 |
@socketio.on('connect')
|
120 |
def handle_connect(auth):
|
121 |
+
client_id = request.sid # クライアントIDを取得
|
122 |
join_room(client_id) # クライアントを自身のルームに入れる
|
123 |
global connected_clients
|
124 |
connected_clients += 1
|
125 |
|
126 |
@socketio.on('disconnect')
|
127 |
def handle_disconnect():
|
128 |
+
client_id = request.sid # クライアントIDを取得
|
129 |
leave_room(client_id) # クライアントをルームから出す
|
130 |
global connected_clients
|
131 |
connected_clients -= 1
|
|
|
148 |
|
149 |
# クライアントIPアドレスを取得
|
150 |
client_ip = get_remote_address()
|
151 |
+
client_id = request.sid # クライアントIDを取得
|
152 |
|
153 |
# 同一IPからの同時タスク数を制限
|
154 |
if tasks_per_client.get(client_ip, 0) >= 2:
|