8000 Discovery occurs for all requests, even ones without the Lodata prefix · Issue #815 · flat3/lodata · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Discovery occurs for all requests, even ones without the Lodata prefix #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
John5 opened this issue Apr 24, 2024 · 0 comments · May be fixed by #860
Open

Discovery occurs for all requests, even ones without the Lodata prefix #815

John5 opened this issue Apr 24, 2024 · 0 comments · May be fixed by #860

Comments

@John5
Copy link
John5 commented Apr 24, 2024

While changing code in LodataServiceProvider I noticed that any error there also is thrown on any other route that does not have the Lodata prefix. This means that all the ODP discovery and setup is done for every request. In my case the ODP functionality is being added to an existing monolith so it adds a significant overhead to all requests to existing routes.

I worked around this by adding a check in the boot() method to see if the path of the request matches the configured Lodata prefix like this:

class LodataServiceProvider extends ServiceProvider
{
    public function boot()
    {
        if (!self::isOdpRequest(\Request::path())) {
            return;
        }
        // DO EVERYTHING ELSE
    }

    public static function isOdpRequest(string $path): bool
    {
        $prefix = \Config::get('lodata.prefix');
        return str_starts_with($path, $prefix);
    }
}

I think it is a good idea to add something like this to the Lodata library by default. Otherwise someone else with a similar issue might find this useful.

@mgerzabek mgerzabek linked a pull request Apr 16, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0