Request: Documentation on `--format json`
lpender opened this issue · comments
PHP version
8.1
Package version
latest
Application
Phar
Operating system
macOS 12.6
Current behavior
It appears to hang, even with --progress
and --verbose
flags
Expected behavior
Should see a .json
file appear or some output to the terminal.
Steps to reproduce
Run a test with --format json
Additional context
Hi,
I'd expect a .json
file to appear or some output when I use --format json
, however, it just seems to go quiet.
The README just says:
The formatter used to print the cache warmup result.
Would love a bit more documentation around how to use this format.
Thanks again!
Hi @lpender, can you provide more information about how you performed cache warmup? The following works perfectly here:
$ ./cache-warmup.phar https://www.google.com/gmail/sitemap.xml -l 5 -f json | jq -r
{
"time": {
"parse": "0.353s",
"crawl": "0.293s"
},
"cacheWarmupResult": {
"success": [
"https://www.google.com/intl/am/gmail/about/policy/",
"https://www.google.com/intl/am/gmail/about/",
"https://www.google.com/intl/ar/gmail/about/",
"https://www.google.com/intl/ar/gmail/about/for-work/",
"https://www.google.com/intl/am/gmail/about/for-work/"
]
}
}
Is it that you don't see the output until it's complete? In that case it may take hours for me to see any output.
Yes, JSON contents are printed once all URLs have been crawled, so that's most probably the issue in your case.
I'll have a look if this can be optimized a little bit, especially for large sitemaps.
Hi @lpender, I've added a small section to the README.md that describes formatters with a bit more context: https://github.com/eliashaeussler/cache-warmup#formatters
In addition, I changed the default output behavior of non-verbose formatters a little bit: If such formatters are used (the json
formatter is considered non-verbose), the progress bar is implicitly enabled and written to the error output (stderr
by default). This should make the whole cache warmup a little bit more verbose when using the json
formatter. I just released v2.4.3 which includes this change.
I'd be happy about a short feedback, if this solves your issue in a reliable way.