Skip to content

Sync bookings to .net bookings calendar - #5160

Open
kristiankunc wants to merge 1 commit into
mainfrom
tech-676-syncing-bookings-to-net-calendar
Open

Sync bookings to .net bookings calendar#5160
kristiankunc wants to merge 1 commit into
mainfrom
tech-676-syncing-bookings-to-net-calendar

Conversation

@kristiankunc

Copy link
Copy Markdown
Contributor

No description provided.

@linear

linear Bot commented Sep 5, 2026

Copy link
Copy Markdown

TECH-676

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ Successfully posted inline: 2 comment(s)

Comment on lines +57 to +63
private function client()
{
return Http::baseUrl($this->url)
->withToken($this->key)
->acceptJson()
->asJson();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[performance · medium]
This HTTP client makes outbound calls to VATSIM.net from a queued worker (SyncToVatsimNet) without any timeout. Guzzle's default timeout/connect_timeout is 0 (wait indefinitely), so a stalled or unresponsive VATSIM.net endpoint can hold a Horizon worker open for an unbounded amount of time. Add explicit ->timeout(...) / ->connectTimeout(...) (e.g. 15s) when building the pending request.

Comment on lines +10 to +12
class BookingObserver
{
private const RELEVANT_FIELDS = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[bug · high]
This observer dispatches the queue job from created/updated/deleted, but it does not implement ShouldHandleEventsAfterCommit. Booking creation and deletion are wrapped in DB transactions (e.g. MentoringSessionsService::acceptSession() -> createCoreBooking(), and BookingService::cancelCtsBooking() -> DB::connection('cts')->transaction(...)). Two consequences follow:

  1. On a sync queue driver (tests/dev), the job runs before the transaction commits, so Booking::find($this->bookingId) in the job returns null and the sync is silently skipped (created bookings never reach VATSIM.net).
  2. If the enclosing transaction later rolls back, the job has already been enqueued and will create/update a remote booking for a record that never persisted.

Other observers in this project (e.g. RosterObserver, TrainingPlaceObserver) already implement ShouldHandleEventsAfterCommit for exactly this reason. Add implements ShouldHandleEventsAfterCommit to defer dispatching until after commit.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant