Skip to content

Commit ae383de

Browse files
committed
fixup! Add a wall clock attached timer for the resampler
Add comment about using __setattr__ to bypass frozen dataclass restriction.
1 parent aa6099d commit ae383de

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/frequenz/sdk/timeseries/_resampling/_wall_clock_timer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ def __post_init__(self) -> None:
248248
wall_clock_elapsed,
249249
)
250250
wall_clock_elapsed = self.monotonic_elapsed * 0.1
251+
# We need to use __setattr__ here to bypass the frozen nature of the
252+
# dataclass. Since we are constructing the class, this is fine and the only
253+
# way to set calculated defaults in frozen dataclasses at the moment.
251254
super().__setattr__(
252255
"wall_clock_factor", self.monotonic_elapsed / wall_clock_elapsed
253256
)

0 commit comments

Comments
 (0)