Skip to content

Commit 0521d91

Browse files
authored
fix: Fix CPU usage calculation (#315)
1 parent ee24dc2 commit 0521d91

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/apify/_platform_event_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def to_crawlee_format(self) -> EventSystemInfoData:
4949
return EventSystemInfoData.model_validate(
5050
{
5151
'cpu_info': {
52-
'used_ratio': self.cpu_current_usage,
52+
'used_ratio': self.cpu_current_usage / 100,
5353
'created_at': self.created_at,
5454
},
5555
'memory_info': {

tests/unit/test_platform_event_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,5 @@ def listener(data: Any) -> None:
200200
await asyncio.sleep(0.1)
201201
assert len(event_calls) == 1
202202
assert event_calls[0] is not None
203-
assert event_calls[0]['cpuInfo']['usedRatio'] == 8.45549815498155
203+
assert event_calls[0]['cpuInfo']['usedRatio'] == 0.0845549815498155
204204
event_calls.clear()

0 commit comments

Comments
 (0)