-
-
Notifications
You must be signed in to change notification settings - Fork 34
set_loop_type supports reverting back to synchronous code #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,9 +18,7 @@ | |
|
|
||
| import collections | ||
| import errno | ||
| import imp | ||
| import numbers | ||
| import os | ||
| import pprint | ||
| import socket | ||
| import ssl | ||
|
|
@@ -48,7 +46,7 @@ | |
| from rethinkdb.handshake import HandshakeV1_0 | ||
| from rethinkdb.logger import default_logger | ||
|
|
||
| __all__ = ['connect', 'set_loop_type', 'Connection', 'Cursor', 'DEFAULT_PORT'] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is abusing |
||
| __all__ = ['Connection', 'Cursor', 'DEFAULT_PORT'] | ||
|
|
||
|
|
||
| DEFAULT_PORT = 28015 | ||
|
|
@@ -705,10 +703,10 @@ def __init__(self, *args, **kwargs): | |
| Connection.__init__(self, ConnectionInstance, *args, **kwargs) | ||
|
|
||
|
|
||
| connection_type = DefaultConnection | ||
|
|
||
|
|
||
| def connect( | ||
|
|
||
| def connect(connection_type, | ||
| host=None, | ||
| port=None, | ||
| db=None, | ||
|
|
@@ -736,24 +734,3 @@ def connect( | |
| return conn.reconnect(timeout=timeout) | ||
|
|
||
|
|
||
| def set_loop_type(library): | ||
| global connection_type | ||
| import pkg_resources | ||
|
|
||
| # find module file | ||
| manager = pkg_resources.ResourceManager() | ||
| libPath = '%(library)s_net/net_%(library)s.py' % {'library': library} | ||
| if not manager.resource_exists(__name__, libPath): | ||
| raise ValueError('Unknown loop type: %r' % library) | ||
|
|
||
| # load the module | ||
| modulePath = manager.resource_filename(__name__, libPath) | ||
| moduleName = 'net_%s' % library | ||
| moduleFile, pathName, desc = imp.find_module(moduleName, [os.path.dirname(modulePath)]) | ||
| module = imp.load_module('rethinkdb.' + moduleName, moduleFile, pathName, desc) | ||
|
|
||
| # set the connection type | ||
| connection_type = module.Connection | ||
|
|
||
| # cleanup | ||
| manager.cleanup_resources() | ||
Uh oh!
There was an error while loading. Please reload this page.