Commit d86f05b3 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Vincent A

config: Only create decorator as needed, more parameters

This is mostly to avoid making the object unpicklable.
Also it should be a bit faster.
parent 1b0ed3bd
......@@ -96,12 +96,16 @@ class TimeBufferConfig(object):
saved_since_seconds = None
def __init__(self, path, saved_since_seconds=None, *args, **kwargs):
def __init__(self, path, saved_since_seconds=None, last_run=True, logger=None, *args, **kwargs):
super(TimeBufferConfig, self).__init__(path, *args, **kwargs)
if saved_since_seconds:
self.saved_since_seconds = saved_since_seconds
if self.saved_since_seconds: = time_buffer(since_seconds=self.saved_since_seconds, last_run=last_run, logger=logger)( = time_buffer(since_seconds=self.saved_since_seconds)(
def save(self, *args, **kwargs):
kwargs.pop('since_seconds', None)
super(TimeBufferConfig, self).save(*args, **kwargs)
def force_save(self):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment