Closed rgomezp closed 1 year ago
Due to the sleep causing delays in the posting response, and also that the notification might not be done sending within 10 seconds what do you think about moving this REST API GET
/notiications/(id)
call to thehas_metadata
?What if in that
has_metadata
method ifget_post_meta($post_id, 'recipients');
returnsnull
we make the REST API request to get the recipients from there?
has_metadata
is only called from the Gutenberg editor, so that wouldn't work for Classic.
It's true that the post would appear to take longer to successfully post, although this is not exactly true. The post publish will be successful, kick off the lifecycle event that fires the notification send and that is what would make the post appear longer to publish from the editor perspective.
The notification is sent immediately, however.
While this is not ideal, there aren't many good options. Some options I've already considered:
pcntl_fork()
) - not guaranteed to be supported on client's servernotice.js
script to wait 10 secs and send a command to the server to make the get notification request after it detects the 200 status on the notification create call. (This is the best option, but still a bit hacky). We would need to refactor the script so that it also runs on the classic editor.
1 sentence summary
Removes the recipient count used in the editor notices.
Overview
In an effort to ease server computational costs, we will no longer return the recipient count as part of the response body to POST notification.
Thus we must remove it from the plugin notices.
Other changes
Update tested up to value to 6.3
This change is