File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 33## Features
44
55* Added support for HMAC signing of client messages
6+ * Added support for streams to be restarted without their channel being closed
67
78## Upgrading
89
Original file line number Diff line number Diff line change @@ -77,6 +77,19 @@ def new_receiver(
7777 limit = maxsize , warn_on_overflow = warn_on_overflow
7878 )
7979
80+ def reconnect (self ) -> None :
81+ """Reconnect to the stream.
82+
83+ This will cancel the current task and create a new one.
84+ """
85+ if not self ._task .done ():
86+ _logger .warning (
87+ "%s: reconnecting to the stream, cancelling the current task" ,
88+ self ._stream_name ,
89+ )
90+ self ._task .cancel ()
91+ self ._task = asyncio .create_task (self ._run ())
92+
8093 @property
8194 def is_running (self ) -> bool :
8295 """Return whether the streaming helper is running.
You can’t perform that action at this time.
0 commit comments