File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
unicorn_binance_websocket_api Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
10
10
[ How to upgrade to the latest version!] ( https://unicorn-binance-websocket-api.docs.lucit.tech/readme.html#installation-and-upgrade )
11
11
12
12
## 2.7.2.dev (development stage/unreleased/unstable)
13
+ ### Added
14
+ - ` clear_asyncio_queue() `
13
15
### Changed
14
16
- Made the logic of ` is_exchange_type() ` better readable.
15
17
### Fixed
Original file line number Diff line number Diff line change @@ -1435,14 +1435,37 @@ def add_total_received_bytes(self, size):
1435
1435
with self .total_received_bytes_lock :
1436
1436
self .total_received_bytes += int (size )
1437
1437
1438
- def clear_stream_buffer (self , stream_buffer_name = False ):
1438
+ def clear_asyncio_queue (self , stream_id : str = None ) -> bool :
1439
+ """
1440
+ Clear the asyncio queue of a specific stream.
1441
+
1442
+ :param stream_id: provide a stream_id
1443
+ :type stream_id: str
1444
+
1445
+ :return: bool
1446
+ """
1447
+ if stream_id is None :
1448
+ logger .error (f"BinanceWebSocketApiManager.clear_asyncio_queue() - Missing parameter `stream_id`!" )
1449
+ return False
1450
+ logger .debug (f"BinanceWebSocketApiManager.clear_asyncio_queue(stream_id={ stream_id } ) - Resetting asyncio_queue "
1451
+ f"..." )
1452
+ try :
1453
+ while True :
1454
+ self .asyncio_queue [stream_id ].get_nowait ()
1455
+ except asyncio .QueueEmpty :
1456
+ logger .debug (
1457
+ f"BinanceWebSocketApiManager.clear_asyncio_queue(stream_id={ stream_id } ) - Finished resetting of "
1458
+ f"asyncio_queue!" )
1459
+ return True
1460
+
1461
+ def clear_stream_buffer (self , stream_buffer_name : Union [Literal [False ], str ] = False ):
1439
1462
"""
1440
1463
Clear the
1441
1464
`stream_buffer <https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_buffer%60>`__
1442
1465
1443
1466
:param stream_buffer_name: `False` to read from generic stream_buffer, the stream_id if you used True in
1444
1467
create_stream() or the string name of a shared stream_buffer.
1445
- :type stream_buffer_name: bool or str
1468
+ :type stream_buffer_name: False or str
1446
1469
:return: bool
1447
1470
"""
1448
1471
if stream_buffer_name is False :
You can’t perform that action at this time.
0 commit comments