-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove queue based on the condition #76
Conversation
@ramyakrishnai Looks good overall, can you take another look at the latest lint issues, please? It would be good to set some limit or throttling too, I see it was a limit of 3 retries at one point, but maybe we add a delay for each retry so we don't end up hammering ourselves with requests. |
I have edited this so
It still does not have:
|
…`::send_event` for v1
includes/API/Events.php
Outdated
if ( $payload && is_array( $payload->data ) ) { | ||
$notifications = $payload; | ||
if ( is_wp_error( $hiive_response_notifications ) ) { | ||
return new \WP_REST_Response( $hiive_response_notifications->get_error_message(), $hiive_response_notifications->get_error_code() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BrianHenryIE We'll want to return an explicit HTTP status code here. The WP_Error get_error_code()
method isn't a status code. It would be something like invalid_rest_request
or some other string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be appropriate to return 500 between the browser and the WP plugin. The browser doesn't really need to know about 401 etc.
Proposed changes
JIRA: https://jira.newfold.com/browse/PRESS0-1495
Description: Right now we are clearing all the events from the queue when they are successfully sent to Hiive without checking whether they were successfully processed by Hiive. The request here is to remove only those events from the queue which are successfully processed by Hiive.
It will mean the failed events will be retried again in the next run. We will have to bring into place a retry mechanisim which will discard the event from queue once max retries reach for that event.
Type of Change
Checklist
Further comments