Skip to content

Commit 98cbad5

Browse files
committed
Finally implement async processing
This should help with #474
1 parent 4ab4c9d commit 98cbad5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

includes/class-receiver.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public static function init() {
4040
// Support Webmention delete
4141
add_action( 'webmention_data_error', array( static::class, 'delete' ) );
4242

43+
// Add scheduler for async processing
44+
add_action( 'webmention_process_schedule', array( static::class, 'process' ) );
45+
4346
self::register_meta();
4447
}
4548

@@ -317,6 +320,17 @@ public static function post( $request ) {
317320
return new WP_REST_Response( $return, 202 );
318321
}
319322

323+
return self::process( $commentdata );
324+
}
325+
326+
/**
327+
* Process the Webmention.
328+
*
329+
* @param array $commentdata The comment data.
330+
*
331+
* @return WP_REST_Response|WP_Error The response or an error.
332+
*/
333+
public static function process( $commentdata ) {
320334
/**
321335
* Filter Comment Data for Webmentions.
322336
*

0 commit comments

Comments
 (0)