Skip to content

Commit b485c77

Browse files
committed
Make plugins inherit from ABC, warn about double initialization
1 parent 4f79082 commit b485c77

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

temporalio/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import abc
56
import asyncio
67
import copy
78
import dataclasses
@@ -7387,7 +7388,7 @@ async def _decode_user_metadata(
73877388
)
73887389

73897390

7390-
class Plugin:
7391+
class Plugin(abc.ABC):
73917392
"""Base class for client plugins that can intercept and modify client behavior.
73927393
73937394
Plugins allow customization of client creation and service connection processes
@@ -7411,7 +7412,7 @@ def init_client_plugin(self, next: Plugin) -> Plugin:
74117412
74127413
This method sets up the chain of responsibility pattern by storing a reference
74137414
to the next plugin in the chain. It is called during client creation to build
7414-
the plugin chain.
7415+
the plugin chain. Note, this may be called twice in the case of :py:meth:`connect`.
74157416
74167417
Args:
74177418
next: The next plugin in the chain to delegate to.

temporalio/worker/_worker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import abc
56
import asyncio
67
import concurrent.futures
78
import hashlib
@@ -88,7 +89,7 @@ def _to_bridge(self) -> temporalio.bridge.worker.PollerBehavior:
8889
]
8990

9091

91-
class Plugin:
92+
class Plugin(abc.ABC):
9293
"""Base class for worker plugins that can intercept and modify worker behavior.
9394
9495
Plugins allow customization of worker creation and execution processes

0 commit comments

Comments
 (0)