Skip to content

Commit

Permalink
fix: [module extractor] remove SIGALRM usage to prevent Flask server …
Browse files Browse the repository at this point in the history
…termination
  • Loading branch information
Terrtia committed Jan 30, 2025
1 parent 86021de commit ca10081
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions bin/lib/module_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@


# SIGNAL ALARM
import signal
def timeout_handler(signum, frame):
raise TimeoutException


signal.signal(signal.SIGALRM, timeout_handler)
# import signal
# def timeout_handler(signum, frame):
# raise TimeoutException
#
#
# signal.signal(signal.SIGALRM, timeout_handler)

# TODO UI Link

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

signal.alarm(60)
# signal.alarm(60)
try:
if not content:
content = obj.get_content()
Expand Down Expand Up @@ -275,8 +275,8 @@ def extract(user_id, obj_type, subtype, obj_id, content=None):
r_cache.expire(f'extractor:cache:{obj_gid}:{user_org}:{user_id}', 300) # TODO Reduce CACHE ???????????????
except TimeoutException:
extracted = []
else:
signal.alarm(0)
# finally:
# signal.alarm(0)

return extracted

Expand Down

0 comments on commit ca10081

Please sign in to comment.