Skip to content
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

Do not make calls to Packagist when creating Projects #1508

Open
franmomu opened this issue May 2, 2021 · 3 comments
Open

Do not make calls to Packagist when creating Projects #1508

franmomu opened this issue May 2, 2021 · 3 comments

Comments

@franmomu
Copy link
Member

franmomu commented May 2, 2021

I wanted to try some commands and took some time to just show the command list and that's because:

public function __construct(PackagistClient $packagist)
{
$this->packagist = $packagist;
$processor = new Processor();
$projectsConfigs = $processor->processConfiguration(new ProjectsConfiguration(), [
'sonata' => ['projects' => Yaml::parseFile(__DIR__.'/../../config/projects.yaml')],
]);
foreach ($projectsConfigs['projects'] as $name => $config) {
$package = $this->packagist->get(sprintf(
'sonata-project/%s',
$name
));
$this->projects[$name] = Project::fromValues($name, $config, $package);
}
}

When instantiating is making several calls to packagist.

@OskarStark
Copy link
Member

We should keep the calls, but maybe cache the response for some time

@franmomu
Copy link
Member Author

franmomu commented May 2, 2021

I meant to make the calls only when needed (and also caching), not when instantiating.

@VincentLanglet
Copy link
Member

In a similar way, it would be nice to do the same for the PR on the github api.
#1563 (comment)

We're doing $this->githubPager->fetchAll($this->github->search(), 'issues', [$query->toString()]) then a call to the api by PR. It could be done only when some extra information are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants