-
Notifications
You must be signed in to change notification settings - Fork 524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @noradtux! Could you please look to address the feedback and add a test case to ensure this is working as expected?
@@ -98,6 +100,13 @@ def __init__(self, | |||
self._database = database | |||
self._timeout = timeout | |||
self._retries = retries | |||
if compression is True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing as we don't know what type the compression
parameter should be. Can you please update the function to include comments on what to expect from this paramater? Should self._compression
be an int, bool, something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, actually it might be int or bool at that point. If it just True the code will choose a default int value. Seemed sensible to me back when I implemented it. Now I am not so sure anymore ... Suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if anything you should define two vars, one for the switch on/off of compression and another for the level.
else: | ||
self._compression = compression | ||
|
||
assert self._compression is False or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we blow up here if we don't match one of the values? This should be set to a proper default and move along without any issue for the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, ok, will do. Usualy I prefer my code to blow up instead of hiding bugs ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you flip this to be two parameters as outline above then this should give you enough assurance that things are working as expected.
|
If you cannot mock out a test for data, just do a simple test to instantiate the client with your options defined and add your I think if anything ensuring the |
I think this is already implemented in #732 |
I think the core if it is indeed implemented in #732, but I saw this as giving users the ability to define the compression level itself. @noradtux if you feel that this is already covered in #732 and you'd like to rebase + amend to fit that structure, then please continue. Otherwise I'm OK if we decide to close this one outright. |
Sorry, didn't have much time to look into this properly. I guess my implementation requires at least python 3.2, so the implementation in #732 seems to be more portable. Hence that one has already been merged this one is redundant and can be closed. |
Modify InfluxDBClient.write() to allow compression of data before posting. Works for me.
Contributor checklist