godaddy-wordpress / godaddy-wordpress/wc-plugin-framework

Harden background job handling

Open
#195 13 comments 0 reactions 1 assignee Claimed by @ragulka View on GitHub
Background Jobs Feature Refactor
Dominant language
PHP
Stars
146
Forks
43
Avg merge
21m
Merged PRs (30d)
3

Description

In our utilities classes, we commonly run into a couple issues:

1. Object caching overrides that improperly handle options (don't purge cache when an option is updated, so job progress is incorrect) -- this can cause duplicated rows in the export file, or extend the time for processing an import.
2. Hosts that block or rate-limit POST requests to the admin-ajax endpoint. This will cause the job to remain queued, as the `maybe_handle()` method in the async request class doesn't fire right away or at all.

To resolve these, we should:

- [x] Use direct SQL queries for setting / getting job status because some hosts don't properly clear the option cache when requested. This will bypass caching.
- [x] Investigate alternatives for [dispatching a job](https://github.com/skyverge/wc-plugin-framework/blob/master/woocommerce/utilities/class-sv-wp-async-request.php#L92-L98) to move it to processing that don't involve a POST request to the admin-ajax endpoint.
- [ ] With ZD 544840, it turned out the server couldn't find its own hostname, so wp remote post using cURL couldn't look up its own DNS and therefore execute that request. We could do some lower level checks to try to ensure the hostname is known, as there have been a couple instances that were similar that I think the same misconfiguration could have been happening.

### Related issues

- https://github.com/skyverge/wc-plugins/issues/1758
- https://github.com/skyverge/wc-plugins/issues/1726
- (CSV Import will need an issue for this too)

### Related threads

- [ZD 527590](https://woothemes.zendesk.com/agent/tickets/527590)
- [ZD 544840](https://woothemes.zendesk.com/agent/tickets/544840)
- [ZD 544490](https://woothemes.zendesk.com/agent/tickets/544490)
- A few others that weren't tagged on our end.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.