Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make participant.joined and participant.left retry logic into a background function #20

Conversation

ebanner
Copy link
Contributor

@ebanner ebanner commented Apr 30, 2024

Make participant.joined and participant.left retry logic into a background function

Fixes #15

This change makes it so we fire off a request to the participant joined/left retry logic in a background function then return immediately to zoom so zoom doesn't send a retry request

Currently, we perform retry logic within the initial zoom request, which is ostensibly causing zoom to time out

This PR is a WIP

Glaring TODO

Don't hardcode my local URL as APP_HOST

https://github.com/Virtual-Coffee/webhooks/pull/20/files#diff-fd3a3971ff32072dc258467648a607790c47e180b8b82e0b426b53c9ea9d8afeR101

@ebanner ebanner marked this pull request as draft April 30, 2024 20:25
@ebanner ebanner force-pushed the make-partipant-joined-left-retry-logic-into-background-function branch 2 times, most recently from 2cf8ce7 to 2791f52 Compare April 30, 2024 20:28
@ebanner
Copy link
Contributor Author

ebanner commented Apr 30, 2024

Hm, actually I'm a bit confused why the call to the background function isn't returning immediately

CALLING handle-participant-joined-background
◈ Rewrote URL to /.netlify/functions/handle-participant-joined-background
Request from ::1: POST /.netlify/functions/handle-participant-joined-background
◈ Queueing background function handle-participant-joined-background for execution
Response with status 202 in 1 ms.
PRINTING REQUEST FROM handle-participant-joined-background
{
  "payload": {
    "account_id": "dkurTIDzTnmj2IvieCpGGA",
    "object": {
      "uuid": "HBhOvHtqRii2FwJjyBcwng==",
      "participant": {
        "user_id": "16778240",
        "user_name": "Eddie B",
        "participant_user_id": "MRL6VzvZRQGOJCCvrgTKww",
        "id": "MRL6VzvZRQGOJCCvrgTKww",
        "join_time": "2024-04-30T20:36:14Z",
        "email": "[email protected]",
        "participant_uuid": "973BEB67-0F15-1F27-2802-98709162FB1F"
      },
      "id": "9904589180",
      "type": 4,
      "topic": "Eddie B's Personal Meeting Room",
      "host_id": "MRL6VzvZRQGOJCCvrgTKww",
      "duration": 0,
      "start_time": "2024-04-30T20:36:15Z",
      "timezone": "America/New_York"
    }
  },
  "event_ts": 1714509377831,
  "event": "meeting.participant_joined"
}
EXITING IMMEDIATELY FROM zoom-meeting-webhook-handler

I feel like the EXITING IMMEDIATELY should be printed right away, not after the background function completes

It's weird because it does say Response with status 202 in 1 ms. immediately. But that's something that's just getting printed internally by netlify, not via console.log()

So this current code as it stands could still be blocking 🤔

@ebanner ebanner force-pushed the make-partipant-joined-left-retry-logic-into-background-function branch from 2791f52 to ad548db Compare April 30, 2024 20:48
@ebanner ebanner force-pushed the make-partipant-joined-left-retry-logic-into-background-function branch from ad548db to 341977b Compare April 30, 2024 20:49
@ebanner
Copy link
Contributor Author

ebanner commented Apr 30, 2024

Oh nevermind. We good 👍

I put a long timeout in the background function to test it and got it to print in the expected order

CALLING handle-participant-joined-background
◈ Rewrote URL to /.netlify/functions/handle-participant-joined-background
Request from ::1: POST /.netlify/functions/handle-participant-joined-background
◈ Queueing background function handle-participant-joined-background for execution
Response with status 202 in 0 ms.
EXITING IMMEDIATELY FROM zoom-meeting-webhook-handler
Response with status 200 in 277 ms.
PRINTING REQUEST FROM handle-participant-joined-background
{
  "payload": {
    "account_id": "dkurTIDzTnmj2IvieCpGGA",
    "object": {
      "uuid": "PyNS75lIQby+Jg9MeKEKTQ==",
      "participant": {
        "leave_time": "2024-04-30T20:55:44Z",
        "user_id": "16778240",
        "user_name": "Eddie B",
        "registrant_id": "",
        "participant_user_id": "MRL6VzvZRQGOJCCvrgTKww",
        "id": "MRL6VzvZRQGOJCCvrgTKww",
        "leave_reason": "left the meeting. Reason : Host ended the meeting.",
        "email": "[email protected]",
        "participant_uuid": "BF89AE4D-053B-7FF7-239B-6C2BACE2337B"
      },
      "id": "9904589180",
      "type": 4,
      "topic": "Eddie B's Personal Meeting Room",
      "host_id": "MRL6VzvZRQGOJCCvrgTKww",
      "duration": 0,
      "start_time": "2024-04-30T20:55:02Z",
      "timezone": "America/New_York"
    }
  },
  "event_ts": 1714510547173,
  "event": "meeting.participant_left"
}
found room instance rechs8vV9QampWqeH
Successfully send message 1714510558.246159 in conversation C04C5AVUMQF
◈ Done executing background function handle-participant-joined-background

@ebanner ebanner marked this pull request as ready for review May 1, 2024 18:42
@ebanner ebanner marked this pull request as draft May 1, 2024 18:42
@ebanner ebanner closed this May 1, 2024
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.

meeting.started event send duplicate posts to the #co-working-room
1 participant