Closed jitendrapurohit closed 2 months ago
@jitendrapurohit It might be worth you looking at some of the changes in #101 - I ended up significantly rewriting some of the contact push/pull stuff but it's been pretty reliable ever since.
Another contact push error:
account_contact
table. So eg if first 10 contacts fails the push, the job keep on trying to push them to xero on every cron run. This PR stores the error_data in the table and prioritise those who doesn't have error_data
filled and tries to push them to xero. Another contact push error:
- The contacts who fails the push for some reason does not store the error_data in the
account_contact
table. So eg if first 10 contacts fails the push, the job keep on trying to push them to xero on every cron run. This PR stores the error_data in the table and prioritise those who doesn't haveerror_data
filled and tries to push them to xero.
That one is fixed in my branch too :-)
@mattwire I've asked Pete to check your changes on any dev site. I'll let you know :)
@jitendrapurohit I've pulled in the parts of @mattwire's branch that relate to these issues & am going to close this. I've mostly tried to copy over @mattwire's code but diverged on trying a different approach on the throttle (moving it into a listener) to make it more consistently handled
Contact Push Errors:
The contact push job queues all the rows to push to xero even when there's no contact_id attached to the account_contact. These rows are normally created from contact pull job and is left to the admins to create a related civi contact for it. I dont think they should be tried to push to xero unless they have a matching civi contact? Hence the condition added.
$accountContacts->addWhere('contact_id', 'IS NOT NULL');
OAuth API limit for xero is 60 calls per minute, but looks like contact push job dont have any limits provided to the sched job. Logs are filled with
Contact Push aborted due to throttling by Xero
messages. Added one now with a default limit for 10 per cron execution.$accountContacts->setLimit($params['limit'] ?? 10);
Invoice Push Errors:
Not sure if this needs to be considered as the API4 issue, but looks like
'accounts_status_id' => ['NOT IN' => [3]],
isn't able to retrieve the account_invoice row ifaccounts_status_id
is NULL in the table. Due to this, those rows are never fetched and are not pushed to Xero. I've added an additional OR to fix this problem.['OR', [['accounts_status_id', '!=', 3], ['accounts_status_id', 'IS NULL']]],