Skip to content

Commit

Permalink
fix deprecation of Event.isSet call (#138)
Browse files Browse the repository at this point in the history
* Additional deprecation fixes

* PubNub SDK 7.0.1 release.

Co-authored-by: Client Engineering Bot <60980775+client-engineering-bot@users.noreply.github.com>
  • Loading branch information
seba-aln and client-engineering-bot committed Oct 6, 2022
1 parent 3e43bd5 commit 54d7e6b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
13 changes: 9 additions & 4 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: python
version: 7.0.0
version: 7.0.1
schema: 1
scm: github.com/pubnub/python
sdks:
Expand All @@ -18,7 +18,7 @@ sdks:
distributions:
- distribution-type: library
distribution-repository: package
package-name: pubnub-7.0.0
package-name: pubnub-7.0.1
location: https://pypi.org/project/pubnub/
supported-platforms:
supported-operating-systems:
Expand Down Expand Up @@ -97,8 +97,8 @@ sdks:
-
distribution-type: library
distribution-repository: git release
package-name: pubnub-7.0.0
location: https://github.com/pubnub/python/releases/download/7.0.0/pubnub-7.0.0.tar.gz
package-name: pubnub-7.0.1
location: https://github.com/pubnub/python/releases/download/7.0.1/pubnub-7.0.1.tar.gz
supported-platforms:
supported-operating-systems:
Linux:
Expand Down Expand Up @@ -169,6 +169,11 @@ sdks:
license-url: https://github.com/aio-libs/aiohttp/blob/master/LICENSE.txt
is-required: Required
changelog:
- date: 2022-10-05
version: 7.0.1
changes:
- type: bug
text: "Remove deprecation warning of Event.is_set and Thread.deamon."
- date: 2022-08-23
version: 7.0.0
changes:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 7.0.1
October 05 2022

#### Fixed
- Remove deprecation warning of Event.is_set and Thread.deamon.

## 7.0.0
August 23 2022

Expand Down
8 changes: 4 additions & 4 deletions pubnub/pubnub.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _register_heartbeat_timer(self):
self._recalculate_interval()

self._timer = threading.Timer(self._timer_interval, self._call_time)
self._timer.setDaemon(True)
self._timer.daemon = True
self._timer.start()

def _call_time(self):
Expand Down Expand Up @@ -265,7 +265,7 @@ def _start_worker(self):
target=consumer.run,
name="SubscribeMessageWorker"
)
self._consumer_thread.setDaemon(True)
self._consumer_thread.daemon = True
self._consumer_thread.start()

def _start_subscribe_loop(self):
Expand Down Expand Up @@ -349,13 +349,13 @@ def _run(self):

def _schedule_next(self):
self._timeout = threading.Timer(self._callback_time, self._run)
self._timeout.setDaemon(True)
self._timer.daemon = True
self._timeout.start()


class NativeSubscribeMessageWorker(SubscribeMessageWorker):
def _take_message(self):
while not self._event.isSet():
while not self._event.is_set():
try:
# TODO: get rid of 1s timeout
msg = self._queue.get(True, 1)
Expand Down
2 changes: 1 addition & 1 deletion pubnub/pubnub_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

class PubNubCore:
"""A base class for PubNub Python API implementations"""
SDK_VERSION = "7.0.0"
SDK_VERSION = "7.0.1"
SDK_NAME = "PubNub-Python"

TIMESTAMP_DIVIDER = 1000
Expand Down
4 changes: 2 additions & 2 deletions pubnub/request_handlers/requests_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def async_request(self, endpoint_name, platform_options, endpoint_call_options,
def callback_to_invoke_in_separate_thread():
try:
envelope = self._build_envelope(platform_options, endpoint_call_options)
if cancellation_event is not None and cancellation_event.isSet():
if cancellation_event is not None and cancellation_event.is_set():
# Since there are no way to affect on ongoing request it's response will
# be just ignored on cancel call
return
Expand Down Expand Up @@ -94,7 +94,7 @@ def execute_callback_in_separate_thread(
target=client.run,
name="Thread-%s-%d" % (operation_name, ++RequestsRequestHandler.ENDPOINT_THREAD_COUNTER)
)
thread.setDaemon(self.pubnub.config.daemon)
thread.daemon = self.pubnub.config.daemon
thread.start()

call_obj.thread = thread
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pubnub',
version='7.0.0',
version='7.0.1',
description='PubNub Real-time push service in the cloud',
author='PubNub',
author_email='support@pubnub.com',
Expand Down

0 comments on commit 54d7e6b

Please sign in to comment.