task: allow specifying heartbeat period
This commit is contained in:
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- It is now possible to specify the period of the `PipelineTask` heartbeat
|
||||||
|
frames with `heartbeats_period_secs`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed a type error when using `voice_settings` in `ElevenLabsHttpTTSService`.
|
- Fixed a type error when using `voice_settings` in `ElevenLabsHttpTTSService`.
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class PipelineParams(BaseModel):
|
|||||||
send_initial_empty_metrics: bool = True
|
send_initial_empty_metrics: bool = True
|
||||||
report_only_initial_ttfb: bool = False
|
report_only_initial_ttfb: bool = False
|
||||||
observers: List[BaseObserver] = []
|
observers: List[BaseObserver] = []
|
||||||
|
heartbeats_period_secs: float = HEARTBEAT_SECONDS
|
||||||
|
|
||||||
|
|
||||||
class Source(FrameProcessor):
|
class Source(FrameProcessor):
|
||||||
@@ -315,7 +316,7 @@ class PipelineTask:
|
|||||||
|
|
||||||
async def _heartbeat_push_handler(self):
|
async def _heartbeat_push_handler(self):
|
||||||
"""
|
"""
|
||||||
This tasks pushes a heartbeat frame every HEARTBEAT_SECONDS.
|
This tasks pushes a heartbeat frame every heartbeat period.
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@@ -323,7 +324,7 @@ class PipelineTask:
|
|||||||
# task will just stop waiting for the pipeline to finish not
|
# task will just stop waiting for the pipeline to finish not
|
||||||
# allowing more frames to be pushed.
|
# allowing more frames to be pushed.
|
||||||
await self._source.queue_frame(HeartbeatFrame(timestamp=self._clock.get_time()))
|
await self._source.queue_frame(HeartbeatFrame(timestamp=self._clock.get_time()))
|
||||||
await asyncio.sleep(HEARTBEAT_SECONDS)
|
await asyncio.sleep(self._params.heartbeats_period_secs)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user