Skip to content

Commit

Permalink
LTI-413: don't do unnecessary db updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariam05 committed Dec 9, 2024
1 parent dbd5527 commit 7e2d8ec
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/jobs/room_meeting_watcher_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def perform(room, data)

info = fetch_meeting_info(data)
if info[:meeting_in_progress]
@chosen_room.update(watcher_job_active: true)
@chosen_room.update(watcher_job_active: true) unless @chosen_room.watcher_job_active # no need to update if it's already true

logger.info("Meeting in progress. Sending broadcast to room '#{room.name}'")
# Broadcast updates to this room’s channel
Expand All @@ -24,7 +24,7 @@ def perform(room, data)

# Broadcast that the meeting ended
MeetingInfoChannel.broadcast_to(room, { meeting_in_progress: false, action: 'end' })
@chosen_room.update(watcher_job_active: false)
@chosen_room.update(watcher_job_active: false) if @chosen_room.watcher_job_active # no need to update if it's already false
# Do not re-enqueue, job ends here
end
end
Expand All @@ -42,8 +42,4 @@ def fetch_meeting_info(data)
data[:participant_count] = info[:participantCount]
data
end

def meeting_running?(info)
info[:returncode] == 'SUCCESS' && info[:running] == true
end
end

0 comments on commit 7e2d8ec

Please sign in to comment.