File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,9 +106,13 @@ public function handle(): void
106106 // This is critical in multi-tenant environments where DB::purge() may have been called
107107 // during tenant switching, causing the Connection object in DatabaseBatchRepository
108108 // to have a null PDO. This fix is safe for non-multi-tenant apps as well.
109+ //
110+ // IMPORTANT: Do NOT purge the landlord connection as it can lose its database
111+ // configuration in multi-tenant setups. The landlord connection should remain stable.
109112 $ batchConnection = config ('queue.batching.database ' );
113+ $ landlordConnection = config ('multitenancy.landlord_database_connection_name ' , 'landlord ' );
110114
111- if ($ batchConnection ) {
115+ if ($ batchConnection && $ batchConnection !== $ landlordConnection ) {
112116 // Purge and reconnect to ensure clean connection state
113117 DB ::purge ($ batchConnection );
114118
You can’t perform that action at this time.
0 commit comments