File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
bindata/assets/deployments Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 80
80
81
81
signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0))
82
82
83
+ ready = threading.Event()
84
+
83
85
def write_index(path, message):
84
86
with open(path, 'wb') as f:
85
87
f.write('\n'.join([
@@ -114,7 +116,8 @@ spec:
114
116
# https://stackoverflow.com/questions/46210672/
115
117
httpd.socket = self.socket
116
118
httpd.server_bind = self.server_close = lambda self: None
117
-
119
+ if self.i == 0:
120
+ ready.set()
118
121
httpd.serve_forever()
119
122
120
123
temp_dir = tempfile.mkdtemp()
@@ -188,12 +191,13 @@ spec:
188
191
addr = ('', 8080)
189
192
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
190
193
else:
191
- raise
194
+ raise
192
195
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
193
196
sock.bind(addr)
194
197
sock.listen(5)
195
198
196
199
[Thread(i, socket=sock) for i in range(100)]
200
+ ready.wait()
197
201
time.sleep(9e9)
198
202
EOF
199
203
exec python3 /tmp/serve.py
You can’t perform that action at this time.
0 commit comments