diff --git a/drivers/place/room_booking_approval.cr b/drivers/place/room_booking_approval.cr index 617b869325..daad3a2039 100644 --- a/drivers/place/room_booking_approval.cr +++ b/drivers/place/room_booking_approval.cr @@ -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 diff --git a/drivers/place/room_booking_approval_spec.cr b/drivers/place/room_booking_approval_spec.cr index 23e295a3b3..c9edce0483 100644 --- a/drivers/place/room_booking_approval_spec.cr +++ b/drivers/place/room_booking_approval_spec.cr @@ -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