Jump to content

Website has become extremely slow


tires
 Share

Recommended Posts

Thank you very much for your advice!

I have indeed found a hook that was apparently to blame. I can't remember exactly why I added it and what it does ...

$wire->addHookAfter('Pages::saveReady', function($event) {
  $event->modules->get('SearchEngine')->indexPages();
  $page = $event->arguments(0);
  $event->wire('log')->save('Page saved', "Page ID: $page->id / Page Name: $page->name / Page Parents: $page->parents");
});

 

  • Like 2
Link to comment
Share on other sites

2 hours ago, tires said:
$event->modules->get('SearchEngine')->indexPages();

You are indexing all the site pages every time a page is saved. You should index only this page since the work for other ones was already done.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...