diff --git a/src/app/Policy/Greylist/Request.php b/src/app/Policy/Greylist/Request.php --- a/src/app/Policy/Greylist/Request.php +++ b/src/app/Policy/Greylist/Request.php @@ -82,13 +82,11 @@ $this->senderLocal = substr($this->senderLocal, 0, 255); } - $entry = $this->findConnectsCollectionRecent()->orderBy('updated_at')->first(); - - if (!$entry) { + if (!$this->findConnectsCollectionRecent()->exist()) { // purge all entries to avoid a unique constraint violation. $this->findConnectsCollection()->delete(); - $entry = Connect::create( + Connect::create( [ 'sender_local' => $this->senderLocal, 'sender_domain' => $this->senderDomain, @@ -102,6 +100,8 @@ 'updated_at' => $this->timestamp ] ); + //FIXME at this point we should be able to just bail out, no? + //An otherwise we don't have to create the entry and can just wait for it to be created at the end of the function? } // See if the recipient opted-out of the feature