wc-plugin-framework icon indicating copy to clipboard operation
wc-plugin-framework copied to clipboard

Harden background job handling

Open bekarice opened this issue 7 years ago • 13 comments

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 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

bekarice avatar Mar 10 '17 00:03 bekarice