Skip to content

Harden background job handling #195

Open
@bekarice

Description

@bekarice

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:

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

Related threads

Metadata

Metadata

Assignees

Labels

Background JobsCode concerning background jobsFeatureRefactorIssues and pull requests that involve refactoring of FW components

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions