perf(subscriptions): batch the price-experiment feature resolution
Resolving PriceExperiment for the shared pricing prop added a separate Pennant select+insert on every authenticated request, blowing the per-page query budget (PageQueryCountTest). Warm all three features this response reads in one values() call so the later per-feature reads hit Pennant's in-memory cache — back to one round-trip, no extra queries.
This commit is contained in:
parent
2dd89e609b
commit
0e4501adbc
|
|
@ -6,6 +6,7 @@ use App\Enums\BankingConnectionStatus;
|
|||
use App\Enums\BankingProvider;
|
||||
use App\Features\CalculateBalancesOnImport;
|
||||
use App\Features\Mcp;
|
||||
use App\Features\PriceExperiment;
|
||||
use App\Jobs\PurgeResidualEncryptionArtifactsJob;
|
||||
use App\Models\BankingConnection;
|
||||
use App\Services\CurrencyOptions;
|
||||
|
|
@ -70,6 +71,18 @@ class HandleInertiaRequests extends Middleware
|
|||
PurgeResidualEncryptionArtifactsJob::dispatch($user);
|
||||
}
|
||||
|
||||
// Warm every Pennant feature this response reads in a single round-trip, so
|
||||
// the per-feature reads below (the price-experiment pricing variant and the
|
||||
// feature flags) hit Pennant's in-memory cache instead of each issuing its
|
||||
// own select + insert.
|
||||
if ($user) {
|
||||
Feature::for($user)->values([
|
||||
CalculateBalancesOnImport::class,
|
||||
Mcp::class,
|
||||
PriceExperiment::class,
|
||||
]);
|
||||
}
|
||||
|
||||
return [
|
||||
...parent::share($request),
|
||||
'flash' => [
|
||||
|
|
|
|||
Loading…
Reference in New Issue