fix(#142): Add missing await keywords in livekit webhook room cleanup#159
fix(#142): Add missing await keywords in livekit webhook room cleanup#159KarthikChowdary07 wants to merge 3 commits intoAOSSIE-Org:mainfrom
Conversation
…om cleanup This commit fixes issue AOSSIE-Org#142 by adding missing 'await' keywords to async function calls in the livekit-webhook room cleanup handler. Changes made: - Added 'await' to appwrite.doesRoomExist() call in log statement - Added 'await' to appwrite.doesRoomExist() call in if condition - Added 'await' to appwrite.deleteRoom() call This ensures proper synchronization of asynchronous database operations and prevents race conditions where the function may return before cleanup completes.
📝 WalkthroughWalkthroughThe LiveKit webhook handler was updated to await the asynchronous room existence check before conditionally calling and awaiting room deletion, and to log the awaited existence result. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@functions/livekit-webhook/src/main.js`:
- Around line 33-36: The code calls appwrite.doesRoomExist twice and deletes the
room unconditionally; fix by calling const exists = await
appwrite.doesRoomExist(appwriteRoomDocId) once, log that value with log(exists),
and then only call await appwrite.deleteRoom(appwriteRoomDocId) inside an if
(exists) branch (remove the duplicate non-awaited delete on the same line as the
if and the unconditional await delete on line 36) so deleteRoom is invoked
exactly once and only when the room exists.
…oesRoomExist calls - Store doesRoomExist result in a variable to avoid redundant calls - Move deleteRoom call inside the if block to ensure it only runs when room exists - This prevents the unconditional deleteRoom call that was executing regardless of room existence Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Ensure doesRoomExist and deleteRoom are awaited and avoid duplicate or unconditional deletion during room cleanup.
KarthikChowdary07
left a comment
There was a problem hiding this comment.
Ensure doesRoomExist and deleteRoom are awaited and avoid duplicate or unconditional deletion during room cleanup.
This commit fixes issue #142 by adding missing 'await' keywords to async function calls in the livekit-webhook room cleanup handler.
Changes made:
This ensures proper synchronization of asynchronous database operations and prevents race conditions where the function may return before cleanup completes.
Summary by CodeRabbit