server->isFunctional() === false) { return 'Server is not functional.'; } $team = data_get($this->server, 'team'); $serverDiskUsageNotificationThreshold = data_get($this->server, 'settings.server_disk_usage_notification_threshold'); if (is_null($this->percentage)) { $this->percentage = $this->server->storageCheck(); } if (! $this->percentage) { return 'No percentage could be retrieved.'; } if ($this->percentage > $serverDiskUsageNotificationThreshold) { $executed = RateLimiter::attempt( 'high-disk-usage:'.$this->server->id, $maxAttempts = 0, function () use ($team, $serverDiskUsageNotificationThreshold) { $team->notify(new HighDiskUsage($this->server, $this->percentage, $serverDiskUsageNotificationThreshold)); }, $decaySeconds = 3600, ); if (! $executed) { return 'Too many messages sent!'; } } else { RateLimiter::hit('high-disk-usage:'.$this->server->id, 600); } } catch (\Throwable $e) { return handleError($e); } } }