fix(2meet-data-optimizer): entity health sees a running backfill

- Backfill batches are scheduled with (entity, group) args; the health
  panel looked for (entity) alone, never saw one and kept offering to start
  a backfill, which resets the group's checkpoint
- is_backfill_active() checks every group of the entity
- Unit bootstrap: wp_next_scheduled() stub honours hook + args
- Verify: EntityHealthBackfillTest (2 new); unit 711, phpcs 0, stan OK
- PR: PR-137 (manual F-11)
This commit is contained in:
2026-09-28 18:18:56 +08:00
parent 6687d54bef
commit 90877b81e0
3 changed files with 59 additions and 2 deletions
+14 -1
View File
@@ -325,7 +325,20 @@ final class TMDO_Entity_Health {
return TMDO_Mode_Manager::ALL_MODES[ $idx - 1 ];
}
/**
* Whether a backfill batch is scheduled for any group of the entity. Batches
* are scheduled with (entity, group) args, so looking for (entity) alone
* never found one (2.4.2 PR-137).
*
* @param string $entity_type Entity type.
* @return bool
*/
private static function is_backfill_active( string $entity_type ): bool {
return (bool) wp_next_scheduled( 'wpdo_entity_backfill_batch', array( $entity_type ) );
foreach ( TMDO_Entity_Registry::get_groups_for_type( $entity_type ) as $group ) {
if ( wp_next_scheduled( 'wpdo_entity_backfill_batch', array( $entity_type, $group ) ) ) {
return true;
}
}
return false;
}
}