Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions datasift/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import json

from multiprocessing import Process
from twisted.internet import reactor
from autobahn.twisted.websocket import WebSocketClientFactory, connectWS

Expand Down Expand Up @@ -82,7 +81,6 @@ def __init__(self, user, apikey, ssl=True, proxies=None, timeout=None, verify=No
WEBSOCKET_HOST,
urlencode(dict(username=config.user, api_key=config.key)))
self.factory = LiveStreamFactory(host, debug=False, useragent=USER_AGENT)
self._stream_process = Process(target=self._stream)
self._stream_process_started = False

def start_stream_subscriber(self):
Expand All @@ -91,11 +89,8 @@ def start_stream_subscriber(self):
Called when the stream consumer has been set up with the correct callbacks.
"""
if not self._stream_process_started: # pragma: no cover
if sys.platform.startswith("win"): # if we're on windows we can't expect multiprocessing to work
self._stream_process_started = True
self._stream()
self._stream_process_started = True
self._stream_process.start()
self._stream()

def subscribe(self, stream):
""" Subscribe to a stream.
Expand Down