I need a decorator (or something that is functionally equivalent) that allows the code below to work as expected:
@timeout(1)
def outer():
inner()
@timeout(5)
def inner():
time.sleep(3)
print("Should never be printed if you call outer()")
outer()
# The outer timeout is ignored and "property" finishes
The code seems pointless, but in reality, outer calls multiple functions that take uncertain amount of time, some of which have their own timeout.
I tried timeout-decorator and two SO answers here, but none works.