File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ def cancelled?
5858 @handle . cancelled?
5959 end
6060
61+ class CancelledError < RuntimeError
62+ end
63+
6164 # Reschedule the timeout to occur at the specified time.
6265 #
6366 # @parameter time [Numeric] The new time to schedule the timeout for.
@@ -72,7 +75,7 @@ def cancelled?
7275
7376 return time
7477 else
75- raise RuntimeError , "Cannot reschedule a cancelled timeout!"
78+ raise CancelledError , "Cannot reschedule a cancelled timeout!"
7679 end
7780 end
7881 end
Original file line number Diff line number Diff line change 4545 expect ( timeout ) . to be ( :cancelled? )
4646 end
4747 end
48+
49+ it "can't reschedule a cancelled timeout" do
50+ scheduler . with_timeout ( 1 ) do |timeout |
51+ timeout . cancel!
52+ expect do
53+ timeout . adjust ( 1 )
54+ end . to raise_exception ( Async ::Timeout ::CancelledError )
55+ end
56+ end
4857 end
4958end
You can’t perform that action at this time.
0 commit comments