Skip to content

Commit ca10081

Browse files
committed
fix: [module extractor] remove SIGALRM usage to prevent Flask server termination
1 parent 86021de commit ca10081

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

bin/lib/module_extractor.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141

4242

4343
# SIGNAL ALARM
44-
import signal
45-
def timeout_handler(signum, frame):
46-
raise TimeoutException
47-
48-
49-
signal.signal(signal.SIGALRM, timeout_handler)
44+
# import signal
45+
# def timeout_handler(signum, frame):
46+
# raise TimeoutException
47+
#
48+
#
49+
# signal.signal(signal.SIGALRM, timeout_handler)
5050

5151
# TODO UI Link
5252

@@ -244,7 +244,7 @@ def extract(user_id, obj_type, subtype, obj_id, content=None):
244244
r_cache.expire(f'extractor:cache:{obj_gid}:{user_org}:{user_id}', 300)
245245
return json.loads(cached)
246246

247-
signal.alarm(60)
247+
# signal.alarm(60)
248248
try:
249249
if not content:
250250
content = obj.get_content()
@@ -275,8 +275,8 @@ def extract(user_id, obj_type, subtype, obj_id, content=None):
275275
r_cache.expire(f'extractor:cache:{obj_gid}:{user_org}:{user_id}', 300) # TODO Reduce CACHE ???????????????
276276
except TimeoutException:
277277
extracted = []
278-
else:
279-
signal.alarm(0)
278+
# finally:
279+
# signal.alarm(0)
280280

281281
return extracted
282282

0 commit comments

Comments
 (0)