Page MenuHomekolab.org

Avoid large queries in greylist request
ClosedPublic

Authored by mollekopf on Aug 27 2021, 10:00 AM.

Details

Reviewers
vanmeeuwen
Group Reviewers
Restricted Project
Commits
rK8beb43d39950: 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.

Diff Detail

Repository
rK kolab
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mollekopf requested review of this revision.Aug 27 2021, 10:00 AM
mollekopf created this revision.
mollekopf added a reviewer: Restricted Project.Aug 27 2021, 10:00 AM
vanmeeuwen accepted this revision.Aug 27 2021, 10:47 AM
This revision is now accepted and ready to land.Aug 27 2021, 10:47 AM
This revision was automatically updated to reflect the committed changes.