Skip to content

Commit d1c067e

Browse files
authored
Merge pull request #62 from bobh66/loop
Fix different loop errors on python 3.12
2 parents 8261272 + c214b4b commit d1c067e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

crossplane/function/runtime.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def serve(
8282
If insecure is true requests will be served insecurely, even if credentials
8383
are supplied.
8484
"""
85+
# Define the loop before the server so everything uses the same loop.
86+
loop = asyncio.get_event_loop()
87+
8588
server = grpc.aio.server()
8689

8790
grpcv1beta1.add_FunctionRunnerServiceServicer_to_server(function, server)
@@ -104,7 +107,6 @@ async def start():
104107
await server.start()
105108
await server.wait_for_termination()
106109

107-
loop = asyncio.get_event_loop()
108110
try:
109111
loop.run_until_complete(start())
110112
finally:

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ packages = ["crossplane"]
7373
[tool.ruff]
7474
target-version = "py311"
7575
exclude = ["crossplane/function/proto/*"]
76-
select = [
76+
lint.select = [
7777
"A",
7878
"ARG",
7979
"ASYNC",
@@ -103,12 +103,12 @@ select = [
103103
"W",
104104
"YTT",
105105
]
106-
ignore = ["ISC001"] # Ruff warns this is incompatible with ruff format.
106+
lint.ignore = ["ISC001"] # Ruff warns this is incompatible with ruff format.
107107

108108
[tool.ruff.lint.per-file-ignores]
109109
"tests/*" = ["D"] # Don't require docstrings for tests.
110110

111-
[tool.ruff.isort]
111+
[tool.ruff.lint.isort]
112112
known-first-party = ["crossplane"]
113113

114114
[tool.ruff.lint.pydocstyle]

0 commit comments

Comments
 (0)