Skip to content

Commit ef4e8c4

Browse files
committed
Fixing a thumbnail server race condition
1 parent ef9549f commit ef4e8c4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/classes/thumbnail.py

+4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ def run(self):
9696
self.thumbServer = httpThumbnailServer(self.server_address, httpThumbnailHandler)
9797
self.thumbServer.serve_forever(0.5)
9898

99+
def __init__(self):
100+
Thread.__init__(self)
101+
self.server_address = None
102+
99103

100104
class httpThumbnailHandler(BaseHTTPRequestHandler):
101105
""" This class handles HTTP requests to the HTTP thumbnail server above."""

src/windows/views/timeline_webview.py

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import os
3131
import sys
32+
import time
3233
from copy import deepcopy
3334
from functools import partial
3435
from random import uniform
@@ -166,6 +167,11 @@ def page_ready(self):
166167
def get_thumb_address(self):
167168
"""Return the thumbnail HTTP server address"""
168169
thumb_server_details = get_app().window.http_server_thread.server_address
170+
while not thumb_server_details:
171+
log.info('No HTTP thumbnail server found yet... keep waiting...')
172+
time.sleep(0.25)
173+
thumb_server_details = get_app().window.http_server_thread.server_address
174+
169175
thumb_address = "http://%s:%s/thumbnails/" % (thumb_server_details[0], thumb_server_details[1])
170176
return thumb_address
171177

0 commit comments

Comments
 (0)