Skip to content
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

Fix bug where we get more than one message in a chunk #875

Merged
merged 3 commits into from
Jul 15, 2018
Merged

Fix bug where we get more than one message in a chunk #875

merged 3 commits into from
Jul 15, 2018

Conversation

tebeka
Copy link
Contributor

@tebeka tebeka commented Jul 8, 2018

No description provided.

@@ -58,13 +58,18 @@ def __init__(self,
self.version = version

def to_json(self):
return json.dumps(self, default=lambda o: o.__dict__)
obj = vars(self).copy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I imagine this affects performance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually a bit faster:

New version

In [1]: from event import Event
In [2]: e = Event()
In [5]: %timeit e.to_json()
4.8 µs ± 9.46 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

Old version

In [1]: from event import Event
In [2]: e = Event()
In [3]: %timeit e.to_json()
6.15 µs ± 22 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

However the main reason was that make test-python failed :)

@pavius pavius merged commit 0d032e7 into nuclio:development Jul 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants