Skip to content

fix(#142): Add missing await keywords in livekit webhook room cleanup#159

Open
KarthikChowdary07 wants to merge 3 commits intoAOSSIE-Org:mainfrom
KarthikChowdary07:KarthikChowdary07-patch-1
Open

fix(#142): Add missing await keywords in livekit webhook room cleanup#159
KarthikChowdary07 wants to merge 3 commits intoAOSSIE-Org:mainfrom
KarthikChowdary07:KarthikChowdary07-patch-1

Conversation

@KarthikChowdary07
Copy link

@KarthikChowdary07 KarthikChowdary07 commented Feb 9, 2026

This commit fixes issue #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.

Summary by CodeRabbit

  • Bug Fixes
    • Improved webhook processing reliability by verifying room existence before deletion, ensuring deletions occur only after confirmation and reducing race conditions.
    • Ensured deletion steps complete before proceeding, preventing incomplete or inconsistent operations in live collaboration sessions.
    • Updated logs to clearly reflect verification results and deletion actions for better operational visibility.

…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.
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Async/Await Fixes
functions/livekit-webhook/src/main.js
Await appwrite.doesRoomExist(...) before deciding to delete; log the awaited result; ensure appwrite.deleteRoom(...) is awaited and executed only after existence verification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

bug

Suggested reviewers

  • M4dhav

Poem

🐇 I hopped through code with eager feet,
Awaiting truth before retreat,
A room checked once, then gone with grace,
No race, no slip, a tidy place,
I nibble logs — async feels sweet!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change—adding missing await keywords to asynchronous calls in the livekit webhook handler. It is concise, specific, and directly reflects the primary modification in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

KarthikChowdary07 and others added 2 commits February 9, 2026 21:57
…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.
Copy link
Author

@KarthikChowdary07 KarthikChowdary07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure doesRoomExist and deleteRoom are awaited and avoid duplicate or unconditional deletion during room cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant