Skip to content

Instantly share code, notes, and snippets.

@danielrobbins
Created August 21, 2012 20:05
Show Gist options
  • Save danielrobbins/3418927 to your computer and use it in GitHub Desktop.
Save danielrobbins/3418927 to your computer and use it in GitHub Desktop.
MySQL connections now receive all relevant configuration options (fixes ZEN-3133; reviewed by jcausey)
Index: /branches/core/zenoss-4.2.x/Products/ZenUtils/MySqlZodbFactory.py
===================================================================
--- /branches/core/zenoss-4.2.x/Products/ZenUtils/MySqlZodbFactory.py (revision 62263)
+++ /branches/core/zenoss-4.2.x/Products/ZenUtils/MySqlZodbFactory.py (revision 63053)
@@ -128,10 +128,10 @@
if socket:
connectionParams['unix_socket'] = socket
- kwargs = {
+ relstoreParams = {
'cache_module_name':'memcache',
'keep_history': kwargs.get('zodb_keep_history', False)
}
adapter = relstorage.adapters.mysql.MySQLAdapter(
- options=relstorage.options.Options(**kwargs),
+ options=relstorage.options.Options(**relstoreParams),
**connectionParams)
@@ -139,7 +139,7 @@
# have the zodb prefix.
if 'zodb_poll_interval' in kwargs:
- kwargs['poll_interval'] = kwargs['zodb_poll_interval']
+ relstoreParams['poll_interval'] = kwargs['zodb_poll_interval']
if 'zodb_cacheservers' in kwargs:
- kwargs['cache_servers'] = kwargs['zodb_cacheservers']
+ relstoreParams['cache_servers'] = kwargs['zodb_cacheservers']
if 'poll_interval' in kwargs:
@@ -149,11 +149,11 @@
log.info("Using default poll-interval of 60 seconds because "
"cache-servers was set.")
- kwargs['poll_interval'] = 60
+ relstoreParams['poll_interval'] = 60
else:
- kwargs['poll_interval'] = poll_interval
+ relstoreParams['poll_interval'] = poll_interval
else:
log.warn("poll-interval of %r is being ignored because "
"cache-servers was not set." % poll_interval)
- storage = relstorage.storage.RelStorage(adapter, **kwargs)
+ storage = relstorage.storage.RelStorage(adapter, **relstoreParams)
cache_size = kwargs.get('zodb_cachesize', 1000)
db = ZODB.DB(storage, cache_size=cache_size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment