Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- run: mk python-sa-types

- run: mk docs version=5.17.10
- run: mk docs version=5.17.11
if: |
matrix.python-version == '3.14'
&& matrix.system == 'ubuntu-latest'
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:

- run: |
mk python-release owner=libre-embedded \
repo=runtimepy version=5.17.10
repo=runtimepy version=5.17.11
if: |
matrix.python-version == '3.14'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.2.4
hash=6cee789c808853d310d4825e0ae0b3ec
hash=75ff258728e82b4bd8f35db4e3783f6c
=====================================
-->

# runtimepy ([5.17.10](https://pypi.org/project/runtimepy/))
# runtimepy ([5.17.11](https://pypi.org/project/runtimepy/))

[![python](https://img.shields.io/pypi/pyversions/runtimepy.svg)](https://pypi.org/project/runtimepy/)
![Build Status](https://github.com/libre-embedded/runtimepy/workflows/Python%20Package/badge.svg)
Expand Down
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 5
minor: 17
patch: 10
patch: 11
entry: runtimepy
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "runtimepy"
version = "5.17.10"
version = "5.17.11"
description = "A framework for implementing Python services."
readme = "README.md"
requires-python = ">=3.13"
Expand Down
4 changes: 2 additions & 2 deletions runtimepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.2.4
# hash=d2c7875a5ee32cef217be9d740dd74e2
# hash=db9fbb88e8b1fdd667c54f44589d7d36
# =====================================

"""
Expand All @@ -10,7 +10,7 @@

DESCRIPTION = "A framework for implementing Python services."
PKG_NAME = "runtimepy"
VERSION = "5.17.10"
VERSION = "5.17.11"

# runtimepy-specific content.
METRICS_NAME = "metrics"
Expand Down
16 changes: 8 additions & 8 deletions runtimepy/mixins/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,30 @@ def __init__(self, level: LogLevellike, path: Pathlike) -> None:
self.level = LogLevel.normalize(level)
self.path = path
self.stream: Optional[Any] = None
self.ctime: int = 0
self.path_size: int = 0

async def get_ctime(self) -> int:
async def get_size(self) -> int:
"""Get ctime for this path."""

return round( # type: ignore
await aiofiles.os.path.getctime(self.path),
)
return (await aiofiles.os.stat(self.path)).st_size # type: ignore

async def handle_open(self) -> None:
"""Handle opening the stream."""

if not self.stream and normalize(self.path).is_file():
self.stream = await aiofiles.open(self.path, mode="r")
await self.stream.seek(0, io.SEEK_END)
self.ctime = await self.get_ctime()
self.path_size = await self.get_size()

async def poll(self) -> AsyncIterator[tuple[LogLevel, str]]:
"""Poll stream contents."""

try:
# Handle re-opening file if necessary.
if self.ctime != await self.get_ctime():
curr = await self.get_size()
if curr < self.path_size:
yield LogLevel.WARNING, f"'{self.path}' truncated, re-opening."
await self.close()
self.path_size = curr

await self.handle_open()
if self.stream:
Expand Down
Loading