Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
- Construct the proper InfluxDB base URL
- Fix the mixin __init__ signature to support the new kwargs
- Remove overly verbose logging
  • Loading branch information
gmr committed Oct 5, 2016
1 parent 05f94a2 commit f345526
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rejected/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
__author__ = 'Gavin M. Roy <[email protected]>'
__since__ = '2009-09-10'
__version__ = '3.13.0'
__version__ = '3.13.1'

import logging
from logging import NullHandler
Expand Down
9 changes: 5 additions & 4 deletions rejected/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class GarbageCollectorMixin(object):
"""
DEFAULT_GC_FREQUENCY = 10000

def __init__(self, settings, process):
self._collection_cycle = settings.get('gc_collection_frequency',
self.DEFAULT_GC_FREQUENCY)
super(GarbageCollectorMixin, self).__init__(settings, process)
def __init__(self, *args, **kwargs):
self._collection_cycle = \
kwargs.get('settings', {}).get('gc_collection_frequency',
self.DEFAULT_GC_FREQUENCY)
super(GarbageCollectorMixin, self).__init__(*args, **kwargs)
self._cycles_left = self.collection_cycle

@property
Expand Down
5 changes: 2 additions & 3 deletions rejected/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ def on_processed(self, message, result, start_time):
self.counters[self.PROCESSED] += 1
self.maybe_submit_measurement()
self.reset_state()
LOGGER.info('Exiting on_processed: %s', self.state_description)

def on_processing_error(self):
"""Called when message processing failure happens due to a
Expand Down Expand Up @@ -854,7 +853,7 @@ def setup_influxdb(self, config):
if key in os.environ:
base_tags[key.lower()] = os.environ[key]
influxdb.install(
'{}://{}:{}'.format(
'{}://{}:{}/write'.format(
config.get('scheme',
os.environ.get('INFLUXDB_SCHEME', 'http')),
config.get('host',
Expand Down Expand Up @@ -892,7 +891,7 @@ def setup_instrumentation(self, config):
# InfluxDB support
if influxdb and config['stats'].get('influxdb'):
self.influxdb = self.setup_influxdb(config['stats']['influxdb'])
LOGGER.debug('InfluxDB measurements configured')
LOGGER.debug('InfluxDB measurements configured: %r', self.influxdb)

def setup_sighandlers(self):
"""Setup the stats and stop signal handlers."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='rejected',
version='3.13.0',
version='3.13.1',
description='Rejected is a Python RabbitMQ Consumer Framework and '
'Controller Daemon',
long_description=open('README.rst').read(),
Expand Down

0 comments on commit f345526

Please sign in to comment.