Disable all external triggers including realtime integration, realtime…#1178
Disable all external triggers including realtime integration, realtime…#1178
Conversation
… transcript, realtime bytes audio due to bad performance, direct affect to core features - live transcript socket
WalkthroughThe changes in this pull request primarily affect the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
backend/routers/transcribe_v2.py (2)
332-332: Clean up unused audio buffer code.The audio buffer initialization and extension are commented out but the variable is still referenced in the webhook section. Since this feature is being disabled, consider removing all related code for better maintainability.
- #audiobuffer = bytearray() try: while websocket_active: data = await websocket.receive_bytes() - #audiobuffer.extend(data)Also applies to: 345-345
369-373: Improve webhook implementation and consider performance optimizations.The developer webhook is disabled due to performance issues. When re-enabling this feature, consider:
- Moving the webhook call to a background task
- Implementing rate limiting
- Adding buffer size limits
- Using feature flags instead of commented code
Example implementation with improvements:
- # Thinh's comment: Temporarily disabled due to bad performance - #if audio_bytes_webhook_delay_seconds and len( - # audiobuffer) > sample_rate * audio_bytes_webhook_delay_seconds * 2: - # asyncio.create_task(send_audio_bytes_developer_webhook(uid, sample_rate, audiobuffer.copy())) - # audiobuffer = bytearray() + if os.getenv('ENABLE_AUDIO_WEBHOOK', 'false').lower() == 'true': + current_time = time.time() + if ( + audio_bytes_webhook_delay_seconds + and len(audiobuffer) > sample_rate * audio_bytes_webhook_delay_seconds * 2 + and current_time - last_webhook_time >= MIN_WEBHOOK_INTERVAL + ): + last_webhook_time = current_time + if len(audiobuffer) > MAX_BUFFER_SIZE: + audiobuffer = audiobuffer[-MAX_BUFFER_SIZE:] + asyncio.create_task(send_audio_bytes_developer_webhook(uid, sample_rate, audiobuffer.copy())) + audiobuffer = bytearray()
| # Thinh's comment: Temporarily disabled due to bad performance | ||
| # realtime plugins + realtime webhook | ||
| asyncio.run_coroutine_threadsafe(trigger_realtime_integrations(uid, segments), loop) | ||
| asyncio.run_coroutine_threadsafe(realtime_transcript_webhook(uid, segments), loop) | ||
| #asyncio.run_coroutine_threadsafe(trigger_realtime_integrations(uid, segments), loop) | ||
| #asyncio.run_coroutine_threadsafe(realtime_transcript_webhook(uid, segments), loop) |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Consider using feature flags instead of commenting out code.
While disabling these features aligns with the PR objectives to address performance issues, using comments to disable code is not ideal for temporary changes. Consider implementing feature flags or configuration settings to control these integrations.
Example implementation using environment variables:
- # Thinh's comment: Temporarily disabled due to bad performance
- # realtime plugins + realtime webhook
- #asyncio.run_coroutine_threadsafe(trigger_realtime_integrations(uid, segments), loop)
- #asyncio.run_coroutine_threadsafe(realtime_transcript_webhook(uid, segments), loop)
+ if os.getenv('ENABLE_REALTIME_INTEGRATIONS', 'false').lower() == 'true':
+ asyncio.run_coroutine_threadsafe(trigger_realtime_integrations(uid, segments), loop)
+ asyncio.run_coroutine_threadsafe(realtime_transcript_webhook(uid, segments), loop)Committable suggestion was skipped due to low confidence.
BasedHardware#1178) … transcript, realtime bytes audio due to bad performance, direct affect to core features - live transcript socket <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced real-time audio processing capabilities with a focus on stability and performance. - **Bug Fixes** - Enhanced error handling for audio data reception and processing. - **Refactor** - Improved logic for managing audio processing tasks and memory creation. - **Chores** - Temporarily disabled real-time integrations and webhook calls to address performance issues. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
… transcript, realtime bytes audio due to bad performance, direct affect to core features - live transcript socket
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores