laravel-timezone
laravel-timezone copied to clipboard
Improve performance. Avoiding extra request.
Hi, I think you are making an extra request if you do not have to update the user timezone. See L50-L60
Maybe you should check first if you have to update the user timezone. See recommended code below:
if (config('timezone.overwrite') == true || $user->timezone == null) {
$ip = $this->getFromLookup();
$geoip_info = geoip()->getLocation($ip);
if ($user->timezone != $geoip_info['timezone']) {
$user->timezone = $geoip_info['timezone'];
$user->save();
$this->notify($geoip_info);
}
}
Hey, tks for the clinic eye on it. I wouldn't say an extra request, but an unnecessary one. We will be fixing soon with the provided suggestion ;)
Just checking in, did this get looked at?
Thanks @rrpadilla for this suggestions.
I was wondering if you would be willing to open a PR with your suggested update so that we could get this into the package. Anything to improve the performance of the package would be greatly appreciated.
Thanks for taking the time to contribute and I hope you continue to enjoy using the package.
James