mirror of
https://github.com/rekryt/iplist.git
synced 2025-10-12 16:39:35 +03:00
feat: make preloading of CIDR asynchronous at application startup
This commit is contained in:
@@ -44,6 +44,25 @@ final class Site {
|
||||
$this->dnsHelper = new DNSHelper($dns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function preload(): void {
|
||||
$startTime = time();
|
||||
App::getLogger()->notice('Preloading for ' . $this->name, ['started']);
|
||||
if ($this->timeout) {
|
||||
$this->cidr4 = SiteFactory::normalize(
|
||||
IP4Helper::processCIDR($this->ip4, SiteFactory::normalize($this->cidr4)),
|
||||
true
|
||||
);
|
||||
$this->cidr6 = SiteFactory::normalize(
|
||||
IP6Helper::processCIDR($this->ip6, SiteFactory::normalize($this->cidr6)),
|
||||
true
|
||||
);
|
||||
}
|
||||
App::getLogger()->notice('Preloaded for ' . $this->name, ['finished', time() - $startTime]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
Reference in New Issue
Block a user