threadify-sdk 0.2.9__tar.gz → 0.2.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {threadify_sdk-0.2.9/threadify_sdk.egg-info → threadify_sdk-0.2.10}/PKG-INFO +1 -1
  2. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/pyproject.toml +1 -1
  3. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/connection.py +17 -0
  4. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/models.py +1 -0
  5. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10/threadify_sdk.egg-info}/PKG-INFO +1 -1
  6. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/CHANGELOG.md +0 -0
  7. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/LICENSE +0 -0
  8. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/MANIFEST.in +0 -0
  9. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/README.md +0 -0
  10. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/setup.cfg +0 -0
  11. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_client.py +0 -0
  12. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_connection.py +0 -0
  13. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_data_retriever.py +0 -0
  14. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_models.py +0 -0
  15. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_notification.py +0 -0
  16. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_step.py +0 -0
  17. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/tests/test_thread.py +0 -0
  18. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/__init__.py +0 -0
  19. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/client.py +0 -0
  20. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/data_retriever.py +0 -0
  21. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/notification.py +0 -0
  22. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/otel_exporter.py +0 -0
  23. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/step.py +0 -0
  24. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify/thread.py +0 -0
  25. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify_sdk.egg-info/SOURCES.txt +0 -0
  26. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify_sdk.egg-info/dependency_links.txt +0 -0
  27. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify_sdk.egg-info/requires.txt +0 -0
  28. {threadify_sdk-0.2.9 → threadify_sdk-0.2.10}/threadify_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: threadify-sdk
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Python SDK for Threadify — Service-delivery intelligence. Track every customer request from start to finish across every system, team, and partner. Visit: https://threadify.dev
5
5
  Author-email: Threadify Team <team@threadify.dev>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "threadify-sdk"
7
- version = "0.2.9"
7
+ version = "0.2.10"
8
8
  description = "Python SDK for Threadify — Service-delivery intelligence. Track every customer request from start to finish across every system, team, and partner. Visit: https://threadify.dev"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -14,6 +14,7 @@ if TYPE_CHECKING:
14
14
  from threadify.models import (
15
15
  ACTION_ACK_NOTIFICATION,
16
16
  ACTION_CLOSE_CONNECTION,
17
+ ACTION_HEARTBEAT,
17
18
  ACTION_JOIN_THREAD,
18
19
  ACTION_NOTIFICATION,
19
20
  ACTION_NOTIFICATION_BATCH,
@@ -84,6 +85,7 @@ class Connection:
84
85
  self._data_retriever: DataRetriever | None = None
85
86
 
86
87
  self._listener_task = asyncio.ensure_future(self._read_loop())
88
+ self._heartbeat_task = asyncio.ensure_future(self._heartbeat_loop())
87
89
 
88
90
  @property
89
91
  def service_name(self) -> str:
@@ -119,6 +121,16 @@ class Connection:
119
121
  finally:
120
122
  self._connected = False
121
123
 
124
+ async def _heartbeat_loop(self) -> None:
125
+ while self._connected:
126
+ await asyncio.sleep(30)
127
+ if not self._connected:
128
+ break
129
+ try:
130
+ await self._send({FIELD_ACTION: ACTION_HEARTBEAT})
131
+ except Exception:
132
+ pass
133
+
122
134
  async def _wait_response(
123
135
  self, match: Callable[[dict], bool], timeout: float = 10.0
124
136
  ) -> dict[str, Any]:
@@ -277,10 +289,15 @@ class Connection:
277
289
  finally:
278
290
  self._connected = False
279
291
  self._listener_task.cancel()
292
+ self._heartbeat_task.cancel()
280
293
  try:
281
294
  await self._listener_task
282
295
  except asyncio.CancelledError:
283
296
  pass
297
+ try:
298
+ await self._heartbeat_task
299
+ except asyncio.CancelledError:
300
+ pass
284
301
  await self._ws.close()
285
302
 
286
303
  def subscribe(
@@ -30,6 +30,7 @@ ACTION_NOTIFICATION = "notification"
30
30
  ACTION_NOTIFICATION_BATCH = "notification_batch"
31
31
  ACTION_CLOSE_CONNECTION = "closeConnection"
32
32
  ACTION_ACK_NOTIFICATION = "ack_notification"
33
+ ACTION_HEARTBEAT = "heartbeat"
33
34
 
34
35
  # Protocol fields
35
36
  FIELD_ACTION = "action"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: threadify-sdk
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Python SDK for Threadify — Service-delivery intelligence. Track every customer request from start to finish across every system, team, and partner. Visit: https://threadify.dev
5
5
  Author-email: Threadify Team <team@threadify.dev>
6
6
  License: MIT
File without changes
File without changes
File without changes