fix CallLaterManager trying to remove pending calls multiple times

This commit is contained in:
Jack Robison 2018-05-23 18:10:23 -04:00
parent aee7a3aa38
commit ae22468fec
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -38,6 +38,7 @@ class CallLaterManager(object):
if call_later.active(): if call_later.active():
call_later.cancel() call_later.cancel()
if call_later in cls._pendingCallLaters:
cls._pendingCallLaters.remove(call_later) cls._pendingCallLaters.remove(call_later)
return reason return reason
return cancel return cancel
@ -53,7 +54,7 @@ class CallLaterManager(object):
canceller = cls._cancel(cls._pendingCallLaters[0]) canceller = cls._cancel(cls._pendingCallLaters[0])
try: try:
canceller() canceller()
except (defer.CancelledError, defer.AlreadyCalledError): except (defer.CancelledError, defer.AlreadyCalledError, ValueError):
pass pass
@classmethod @classmethod