Performance fix for address_merge, when there are a log of echomails to move to the new address
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m39s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-05-06 08:23:07 +10:00
parent c8ef7d065b
commit 2765a27db8

View File

@ -346,7 +346,11 @@ class SystemController extends Controller
->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id']) ->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id'])
->whereIn('address_id',[$request->src]) ->whereIn('address_id',[$request->src])
->distinct() ->distinct()
->with(['seenby:id']) ->with(['seenby'=>function($query) use ($request) {
return $query
->select('id')
->whereIn('address_id',[$request->src,$request->dst]);
}])
->get() ->get()
->filter(function($item) use ($request) { ->filter(function($item) use ($request) {
return $item->seenby->contains($request->dst) && $item->seenby->contains($request->src); return $item->seenby->contains($request->dst) && $item->seenby->contains($request->src);