Issue and Findings
This issue was raised previously (in
3024444 β
) but it was closed and I'm still experiencing the problem despite the patch.
When I use the Generate button at admin/config/tome/static/generate, the resultant static site files display the "active" class on the wrong menu links. According to the previous issue, this is due to the "path-count" parameter defaulting to a number higher than 1 because Drupal is not intended to handle concurrent requests. The result is the active class is applied to the first link of all pages in the chunk of paths being processed simultaneously.
For example, the default value of path-count is 5. After static generation, the menu on the first five pages will look like this:
- Page 1
- Page 2
- Page 3
- Page 4
- Page 5
"Page 1" is bolded on each of the five pages, instead of the bold style appearing on the link that represents the current page.
I tried to manually adjust path-count in the script by changing the PATH_COUNT constant and hard-coding test values into the script along the trace path, ending with exportPath in StaticCommand.php, but the error persists (and running top displayed <=5 php-fpm processes during the generation run instead of the test value I used of 15). Now, I may be missing something (does Drupal cache module scripts or something? I don't think so because I was able to add another button to the Generate page no problem), but I have been unable to make this workable for me by hard-coding my values into the module. Otherwise, I wouldn't bother you all again on this item :P
I understand that running drush tome:static allows me to pass path-count and process-count parameters in the command, and I have built an external script to do just this. However, the drush command is not ideal because:
- it spawns php processes instead of utilizing php-fpm, so my CPU usage runs at 80% for the entirety of the generation process instead of ~20% CPU usage when generate is run in the GUI
- it renders Drupal unusable for the duration of the generation process
Treatment
For me personally, I could live with manually hard-coding my values into the module.
For a universal solution, is it possible to allow the user to enter their path-count and process-count value into the GUI? Either on the Generate page itself, or Config page (similar to Tome Netlify config)?
Thank you for such a great module!