Skip to content

Commit 45149bc

Browse files
committed
feat: add gevent async env support
Signed-off-by: Gabor Boros <gabor.brs@gmail.com>
1 parent 8441a57 commit 45149bc

File tree

7 files changed

+960
-23
lines changed

7 files changed

+960
-23
lines changed

poetry.lock

Lines changed: 184 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pyyaml = "^6.0.2"
5454

5555
twisted = { version = "^25.5", optional = true }
5656
tornado = { version = "^6.5", optional = true }
57+
gevent = { version = "^25.5", optional = true }
5758

5859
[tool.poetry.group.dev.dependencies]
5960
black = "^25.1"
@@ -68,9 +69,10 @@ pytest-twisted = "^1.14"
6869
pytest-asyncio = "^0.25"
6970

7071
[tool.poetry.extras]
71-
all = ["twisted", "tornado"]
72+
all = ["twisted", "tornado", "gevent"]
7273
twisted = ["twisted"]
7374
tornado = ["tornado"]
75+
gevent = ["gevent"]
7476

7577
[tool.black]
7678
target-version = ['py312']

rethinkdb/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,10 @@ def set_loop_type(self, library=None) -> None:
257257
library = None
258258

259259
if library == "gevent":
260-
warnings.warn(f"{library} is not yet supported, using the default one")
261-
library = None
260+
# pylint: disable=import-outside-toplevel
261+
from rethinkdb.net_gevent import Connection as GeventConnection
262+
263+
self.connection_type = GeventConnection
262264

263265
if library == "tornado":
264266
# pylint: disable=import-outside-toplevel

rethinkdb/cli/_restore.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,16 @@ def query_runner(description, query):
247247
logger.info("Starting data import...")
248248
try:
249249
import_tables(import_options, sources)
250-
except RuntimeError as ex:
250+
except RuntimeError as exc:
251251
if options.get("debug", False):
252252
traceback.print_exc()
253253

254-
if str(ex) == "Warnings occurred during import":
254+
if str(exc) == "Warnings occurred during import":
255255
raise RuntimeError(
256256
"Warning: import did not create some secondary indexes."
257257
)
258258
else:
259-
error_string = str(ex)
259+
error_string = str(exc)
260260
if error_string.startswith("Error: "):
261261
error_string = error_string[len("Error: ") :]
262262
raise RuntimeError(f"Error: import failed: {error_string}")
@@ -433,8 +433,8 @@ def cmd_restore(
433433
try:
434434
do_restore(options)
435435
return 0
436-
except RuntimeError as ex:
437-
logger.error("Restore failed: %s", ex)
436+
except RuntimeError as exc:
437+
logger.error("Restore failed: %s", exc)
438438
return 1
439439

440440

0 commit comments

Comments
 (0)