Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion drivers/place/room_booking_approval.cr
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ class Place::RoomBookingApproval < PlaceOS::Driver
# Multiple calls within the 10-second window are batched into a
# single poll_events call per affected system, giving the calendar
# provider time to propagate the status change.
protected def refresh_bookings(system_ids : Array(String))
# The exec runtime waits on any returned task, so this must not return
# the scheduled one.
protected def refresh_bookings(system_ids : Array(String)) : Nil
return if @disable_refresh_bookings
@pending_refresh.concat(system_ids)
return if @refresh_scheduled
Expand Down
5 changes: 5 additions & 0 deletions drivers/place/room_booking_approval_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,20 @@ DriverSpecs.mock_driver "Place::RoomBookingApproval" do

poll_before = system(:Bookings_1)[:poll_events_calls].as_i

# The exec must respond before the debounce fires, not wait for it.
started = Time.monotonic
exec(:accept_event,
calendar_id: "room5@example.com",
event_id: "tentative-event-1",
).get
(Time.monotonic - started).should be < 5.seconds

started = Time.monotonic
exec(:decline_event,
calendar_id: "room5@example.com",
event_id: "tentative-event-4",
).get
(Time.monotonic - started).should be < 5.seconds

sleep 11

Expand Down
Loading