Skip to content

Commit cab1b18

Browse files
committed
Make CommonService.transport the canonical way to retrieve transport
The classes internally are set up to allow empty or null transport, which we almost never want to actually use. Use this property as a way of retrieving the concrete transport (or failing) rather than handling None logic everywhere that we don't need it
1 parent 6fc0d68 commit cab1b18

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/workflows/services/common_service.py

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

1818
import workflows
1919
import workflows.logging
20+
from workflows.transport.common_transport import CommonTransport
2021
from workflows.transport.middleware.otel_tracing import OTELTracingMiddleware
2122

2223

@@ -171,11 +172,14 @@ def config(self):
171172
return self._environment.get("config")
172173

173174
@property
174-
def transport(self):
175+
def transport(self) -> CommonTransport:
176+
# Handle the fact that we apparently allow missing transport layers
177+
if self._transport is None:
178+
raise RuntimeError("Transport layer has not yet been defined")
175179
return self._transport
176180

177181
@transport.setter
178-
def transport(self, value):
182+
def transport(self, value: CommonTransport) -> None:
179183
if self._transport:
180184
raise AttributeError("Transport already defined")
181185
self._transport = value

0 commit comments

Comments
 (0)