Skip to content
Snippets Groups Projects
Commit 5f5b7af7 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fix a subtle bug in _CPUProfileBuilderThread.get_own_cpu_usage

parent d19b5d4b
No related branches found
No related tags found
No related merge requests found
Pipeline #62632 passed with stages
in 1 minute and 56 seconds
......@@ -2,6 +2,9 @@
* deprecated rethrow_as
* fixed circular import
* paths changed in pyproject.toml
* removed prints from unit tests
* fixed a subtle bug in _CPUProfileBuilderThread.get_own_cpu_usage
# v2.25.5
......
......@@ -27,7 +27,9 @@ coverage
```
It's still free, MIT-licensed and publicly available. No one's taking it from you :)
I'll try to submit the builds to PyPI as well
**I'll try to submit the builds to regular [PyPI](https://pypi.org/project/satella/) as well!!**
What is Satella?
----------------
......
......@@ -45,11 +45,11 @@ max-line-length = 119
universal = true
[project.urls]
Homepage = "https://github.com/piotrmaslanka/satella"
Documentation = "https://satella.readthedocs.io/"
Issues = "https://github.com/piotrmaslanka/satella/issues"
Repository = "https://github.com/piotrmaslanka/satella"
Changelog = "https://github.com/piotrmaslanka/satella/blob/develop/CHANGELOG.md"
Homepage = "https://git.dms-serwis.com.pl/smokserwis/satella"
Documentation = "https://smokserwis.docs.smok.co/satella"
Issues = "https://git.dms-serwis.com.pl/smokserwis/satella/-/issues"
Repository = "https://git.dms-serwis.com.pl/smokserwis/satella"
Changelog = "https://git.dms-serwis.com.pl/smokserwis/satella/-/blob/master/CHANGELOG.md?ref_type=heads"
[tool.setuptools]
packages = ["satella",
......
......@@ -75,6 +75,7 @@ class _CPUProfileBuilderThread(SingleStartThread):
time_c, times_c = self.own_load_average[-1]
difference = time_c - time_p
if difference == 0:
del self.own_load_average[-2]
return None
tuple_build = {}
for field in times_v._fields: # pylint: disable=protected-access
......
......@@ -44,14 +44,12 @@ class TestResources(unittest.TestCase):
def acquire_connection(self):
v = super().acquire_connection()
print(f'Acquiring connection {v.id}')
if v.id in self.already_acquired:
raise RuntimeError('Reacquiring an acquired connection')
self.already_acquired.add(v.id)
return v
def release_connection(self, connection) -> None:
print(f'Releasing connection {connection.id}')
self.already_acquired.remove(connection.id)
super().release_connection(connection)
......
......@@ -61,9 +61,9 @@ class TestCPUTime(unittest.TestCase):
try:
with measure(timeout=30) as m:
while not m.timeouted:
time.sleep(5)
time.sleep(10)
usage = get_own_cpu_usage()
if usage.user > 0.9:
if usage.user > 0.6:
break
else:
self.fail('Timeout when waiting for significant CPU usage')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment