Avoid large queries in greylist request
Summary:
The assumption is that the following query can yield a lot of results
for e.g. gmail.com:
$entries = Connect::where( [ 'sender_domain' => $this->senderDomain, 'net_id' => $this->netID, 'net_type' => $this->netType ] ) ->whereDate('updated_at', '>=', $this->timestamp->copy()->subDays(7));
Instead of counting and updating all of them, we only to the minimum
work necessary:
- Update all entries that are currently greylisted
- Count if we have at least 5 entries to automatically create a whitelist
This changes that entries that already have greylisting = false will
not get updated_at updated.
Differential Revision: https://git.kolab.org/D2833