mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-20 22:04:02 +00:00
Add comments for clarity (re-fetching and event firing)
This commit is contained in:
parent
4b989d87b0
commit
698589edbd
1 changed files with 5 additions and 0 deletions
|
|
@ -111,6 +111,9 @@ trait HasPending
|
|||
return $firstOrCreate ? static::create($attributes) : null;
|
||||
}
|
||||
|
||||
// Fired before the claim, so it can fire once per attempt, including for a candidate
|
||||
// that ends up being claimed by a concurrent process (in which case the loop retries).
|
||||
// PendingTenantPulled (below) fires exactly once, for the pulled tenant.
|
||||
event(new PullingPendingTenant($pullCandidate));
|
||||
|
||||
$tenant = DB::transaction(function () use ($pullCandidate, $attributes): ?Tenant {
|
||||
|
|
@ -122,6 +125,8 @@ trait HasPending
|
|||
return null;
|
||||
}
|
||||
|
||||
// The tenant's pending_since was just cleared, and e.g. a PullingPendingTenant listener
|
||||
// may have made changes to the tenant, so re-fetch it to get it in the correct state.
|
||||
/** @var Model&Tenant $pulledTenant */
|
||||
$pulledTenant = static::findOrFail($pullCandidate->getKey());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue