Return instead of forcibly exiting
This makes no difference currently as the script doesn't do anything after this function finishes, but it allows any cleanup work to happen at the end.
This commit is contained in:
parent
ad682f3d1b
commit
0e5c374449
@ -261,19 +261,19 @@ def terminate_long_pause(session_id, message, limit, interval, notify=None):
|
|||||||
if state == 'paused':
|
if state == 'paused':
|
||||||
if checked_time >= limit:
|
if checked_time >= limit:
|
||||||
terminate_session(session_id, message, notify)
|
terminate_session(session_id, message, notify)
|
||||||
sys.exit(0)
|
return
|
||||||
else:
|
else:
|
||||||
sleep(interval)
|
sleep(interval)
|
||||||
elif state == 'playing' or state == 'buffering':
|
elif state == 'playing' or state == 'buffering':
|
||||||
sys.stdout.write(
|
sys.stdout.write(
|
||||||
"Session '{}' has resumed, ".format(session_id) +
|
"Session '{}' has resumed, ".format(session_id) +
|
||||||
"stopping monitoring.")
|
"stopping monitoring.")
|
||||||
sys.exit(0)
|
return
|
||||||
if not found_session:
|
if not found_session:
|
||||||
sys.stdout.write(
|
sys.stdout.write(
|
||||||
"Session '{}' is no longer active ".format(session_id) +
|
"Session '{}' is no longer active ".format(session_id) +
|
||||||
"on the server, stopping monitoring.")
|
"on the server, stopping monitoring.")
|
||||||
sys.exit(0)
|
return
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user