From 4683fc3b949bf0294fa5a6f0cd91f850c418aa34 Mon Sep 17 00:00:00 2001 From: Nazariy Date: Sat, 26 Jan 2019 17:59:37 +0000 Subject: [PATCH 1/2] [+] WebSocketClient thread naming 1. Added kwarg in the constructor of the WSC to name the thread on which it runs 2. Added kwarfg for the keepalive thread. --- cbpro/websocket_client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cbpro/websocket_client.py b/cbpro/websocket_client.py index f1b0f97..88b45f7 100644 --- a/cbpro/websocket_client.py +++ b/cbpro/websocket_client.py @@ -19,7 +19,8 @@ class WebsocketClient(object): def __init__(self, url="wss://ws-feed.pro.coinbase.com", products=None, message_type="subscribe", mongo_collection=None, - should_print=True, auth=False, api_key="", api_secret="", api_passphrase="", channels=None): + should_print=True, auth=False, api_key="", api_secret="", api_passphrase="", channels=None, + thread_name='WebsocketClient', keepalive_thread_name='WebsocketClientKeepAlive): self.url = url self.products = products self.channels = channels @@ -43,8 +44,8 @@ def _go(): self.stop = False self.on_open() - self.thread = Thread(target=_go) - self.keepalive = Thread(target=self._keepalive) + self.thread = Thread(target=_go, name=thread_name) + self.keepalive = Thread(target=self._keepalive, name=keeaplive_thread_name) self.thread.start() def _connect(self): From e1d4bd149de7534c26291ca070f437e17647067e Mon Sep 17 00:00:00 2001 From: Nazariy Date: Sat, 26 Jan 2019 19:46:36 +0000 Subject: [PATCH 2/2] Added ' in the name --- cbpro/websocket_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cbpro/websocket_client.py b/cbpro/websocket_client.py index 88b45f7..aace370 100644 --- a/cbpro/websocket_client.py +++ b/cbpro/websocket_client.py @@ -20,7 +20,7 @@ class WebsocketClient(object): def __init__(self, url="wss://ws-feed.pro.coinbase.com", products=None, message_type="subscribe", mongo_collection=None, should_print=True, auth=False, api_key="", api_secret="", api_passphrase="", channels=None, - thread_name='WebsocketClient', keepalive_thread_name='WebsocketClientKeepAlive): + thread_name='WebsocketClient', keepalive_thread_name='WebsocketClientKeepAlive'): self.url = url self.products = products self.channels = channels