fix: fetch pending with token in query string to survive LiteSpeed caching
This commit is contained in:
@@ -66,7 +66,7 @@ This directory contains the **v2.6.0 Standalone VPS Worker**, designed for high-
|
|||||||
All endpoints require either WordPress admin authentication OR a valid `X-Peptide-News-Token: <your-token>` header:
|
All endpoints require either WordPress admin authentication OR a valid `X-Peptide-News-Token: <your-token>` header:
|
||||||
|
|
||||||
- `GET /wp-json/peptide-news/v1/worker/pending?limit=20`
|
- `GET /wp-json/peptide-news/v1/worker/pending?limit=20`
|
||||||
Returns pending articles requiring AI analysis.
|
Returns pending articles requiring AI analysis. The worker fetches this with the token also in the query string (`&token=...`) so the cached response is namespaced by the secret, which survives shared-host LiteSpeed caching that ignores `X-LiteSpeed-Cache-Control: no-cache`; the header is still sent alongside.
|
||||||
- `POST /wp-json/peptide-news/v1/worker/update`
|
- `POST /wp-json/peptide-news/v1/worker/update`
|
||||||
Updates an article with completed AI summaries, tags, and scientific rigor scores.
|
Updates an article with completed AI summaries, tags, and scientific rigor scores.
|
||||||
- `POST /wp-json/peptide-news/v1/worker/ingest`
|
- `POST /wp-json/peptide-news/v1/worker/ingest`
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function wp_rest_call( string $url, string $token, string $method = 'GET', array
|
|||||||
|
|
||||||
if ( $action === 'pending' ) {
|
if ( $action === 'pending' ) {
|
||||||
vps_log( "Fetching pending articles from {$wp_url}/wp-json/peptide-news/v1/worker/pending ..." );
|
vps_log( "Fetching pending articles from {$wp_url}/wp-json/peptide-news/v1/worker/pending ..." );
|
||||||
$res = wp_rest_call( "{$wp_url}/wp-json/peptide-news/v1/worker/pending?limit={$batch}", $token );
|
$res = wp_rest_call( "{$wp_url}/wp-json/peptide-news/v1/worker/pending?limit={$batch}&token={$token}", $token );
|
||||||
if ( ! $res || empty( $res['success'] ) ) {
|
if ( ! $res || empty( $res['success'] ) ) {
|
||||||
vps_log( "Failed to retrieve pending articles." );
|
vps_log( "Failed to retrieve pending articles." );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
@@ -105,7 +105,7 @@ if ( $action === 'process-llm' ) {
|
|||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
vps_log( "Pulling up to {$batch} pending articles from WordPress..." );
|
vps_log( "Pulling up to {$batch} pending articles from WordPress..." );
|
||||||
$res = wp_rest_call( "{$wp_url}/wp-json/peptide-news/v1/worker/pending?limit={$batch}", $token );
|
$res = wp_rest_call( "{$wp_url}/wp-json/peptide-news/v1/worker/pending?limit={$batch}&token={$token}", $token );
|
||||||
if ( ! $res || empty( $res['success'] ) || empty( $res['data'] ) ) {
|
if ( ! $res || empty( $res['success'] ) || empty( $res['data'] ) ) {
|
||||||
vps_log( "No pending articles found or failed to retrieve." );
|
vps_log( "No pending articles found or failed to retrieve." );
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
|
|||||||
Reference in New Issue
Block a user