Skip to content

Conversation

JanJakes
Copy link
Member

The following query from Action Scheduler was still failing:

UPDATE wp_actionscheduler_actions t1
JOIN (
  SELECT action_id from wp_actionscheduler_actions
  WHERE claim_id = 0 AND scheduled_date_gmt <= '2025-09-03 12:23:55' AND status='pending'
  ORDER BY priority ASC, attempts ASC, scheduled_date_gmt ASC, action_id ASC
  LIMIT 25
  FOR UPDATE
) t2 ON t1.action_id = t2.action_id
SET claim_id=37, last_attempt_gmt='2025-09-03 12:23:55', last_attempt_local='2025-09-03 12:23:55

This was due to the derived table subquery in JOIN and the FOR UDPATE clause.

This PR moves the derived subquery to the FROM clause, and strips away the locking clauses like FOR UPDATE.

@JanJakes JanJakes force-pushed the update-with-join-fixes branch from 5a18bb8 to cbaa6e0 Compare September 12, 2025 08:50
@JanJakes JanJakes force-pushed the update-with-join-fixes branch from cbaa6e0 to 8fd5cbc Compare September 12, 2025 09:13
@JanJakes JanJakes force-pushed the update-with-join-fixes branch from 8fd5cbc to 64e6faa Compare September 12, 2025 09:14
@JanJakes JanJakes requested a review from adamziel September 12, 2025 09:34
@JanJakes
Copy link
Member Author

@adamziel This is an important fix for #238. I'll merge and tag it now and then hope to finally focus on the better test coverage of the new functionality.

@JanJakes JanJakes merged commit bff6aad into develop Sep 12, 2025
14 checks passed
@JanJakes JanJakes deleted the update-with-join-fixes branch September 12, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant