1 files changed, 10 insertions, 9 deletions
diff --git a/app.py b/app.py
index 831aee8..7793ce6 100644
--- a/app.py
+++ b/app.py
@@ -88,15 +88,16 @@ def random(topic):
if topic not in taxonomy:
return abort(500)
- if not preloaded_queues[topic].full():
- exc = ThreadPoolExecutor(max_workers=2)
- for _ in range(2):
- exc.submit(preload_random, topic)
- exc.shutdown(wait=False)
-
- if not preloaded_queues[topic].empty():
- entry = preloaded_queues[topic].get()
- return render_template('topic.html',
+ if topic in preload_topics:
+ if not preloaded_queues[topic].full():
+ exc = ThreadPoolExecutor(max_workers=2)
+ for _ in range(2):
+ exc.submit(preload_random, topic)
+ exc.shutdown(wait=False)
+
+ if not preloaded_queues[topic].empty():
+ entry = preloaded_queues[topic].get()
+ return render_template('topic.html',
description=entry['description'],
title=entry['title'],
link=entry['link'],
|