Skip to content

Commit

Permalink
add event report limit (#844)
Browse files Browse the repository at this point in the history
* add limit

* version

* add annotation

---------

Co-authored-by: wujiasheng03 <[email protected]>
  • Loading branch information
noO0oOo0ob and wujiasheng03 authored Apr 26, 2024
1 parent 11efd9c commit 0a0eaa3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lyrebird/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def broadcast_handler(self, callback_fn, event, args, kwargs):
finally:
event_end_time = time.time()
event_duration = (event_end_time - event_start_time) * 1000
if event.channel != 'lyrebird_metrics':
# Report the operation of Event
# Prevent loop reporting, and only time-consuming event(more than 1ms) are reported
if event.channel != 'lyrebird_metrics' and event_duration > 1:
trace_info = {
'channel': event.channel,
'callback_fn': callback_fn.__name__,
Expand Down
2 changes: 1 addition & 1 deletion lyrebird/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
IVERSION = (2, 26, 2)
IVERSION = (2, 26, 3)
VERSION = ".".join(str(i) for i in IVERSION)
LYREBIRD = "Lyrebird " + VERSION
4 changes: 2 additions & 2 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_reset(event_server, task_server, db_server):
event_server.publish(channel_name, message)
time.sleep(0.2)
events = db_server.get_event([])
assert len(events) == publish_time*2
assert len(events) == publish_time

db_server.reset()
events = db_server.get_event([])
Expand All @@ -64,7 +64,7 @@ def test_reset(event_server, task_server, db_server):
event_server.publish(channel_name, message)
time.sleep(0.2)
events = db_server.get_event([])
assert len(events) == publish_time*2
assert len(events) == publish_time


def test_get_event_with_multiple_search_str(event_server, task_server, db_server):
Expand Down

0 comments on commit 0a0eaa3

Please sign in to comment.