| @@ -45,11 +45,22 @@ | ||
| 45 | 45 | final class Visibility_Observer { |
| 46 | 46 | /** |
| 47 | 47 | * Bump when the seeded set changes shape and every install must re-announce it. |
| 48 | 48 | * |
| 49 | + * History: | |
| 50 | + * - 1 (1.10.1): first announcement, for records hidden before the observer existed. | |
| 51 | + * - 2 (1.10.16): re-announcement. Between 1.10.1 and 1.10.14 the catalogue search | |
| 52 | + * lane served hidden records when a search carried late `include` ids | |
| 53 | + * (wcpos/woocommerce-pos#1990), so tills that searched during that window hold | |
| 54 | + * hidden products the seed-1 tombstones predate and the stream never mentions | |
| 55 | + * again. Re-seeding drops them through the ordinary changes pull on the next | |
| 56 | + * tick; the client's existence audit would otherwise be the only path, and on a | |
| 57 | + * host that reports sustained pressure that audit runs at a trickle | |
| 58 | + * (wcpos/monorepo#2078). | |
| 59 | + * | |
| 49 | 60 | * @var int |
| 50 | 61 | */ |
| 51 | - public const SEED_VERSION = 1; | |
| 62 | + public const SEED_VERSION = 2; | |
| 52 | 63 | |
| 53 | 64 | /** |
| 54 | 65 | * The one-time seed latch. |
| 55 | 66 | * |
| @@ -129,9 +140,14 @@ | ||
| 129 | 140 | if ( (int) get_option( self::SEED_VERSION_OPTION, 0 ) >= self::SEED_VERSION ) { |
| 130 | 141 | return; |
| 131 | 142 | } |
| 132 | 143 | |
| 133 | - $this->journal->append_catalogue_tombstones( $this->visibility->hidden_ids( Pos_Visibility::CATALOG ) ); | |
| 144 | + // Latch only once the rows are in: a transient write failure (missing table, dead | |
| 145 | + // connection) that latched anyway would never be retried, and the copies this seed | |
| 146 | + // exists to remove would stay on every till (Codex review, #1995). | |
| 147 | + if ( ! $this->journal->append_catalogue_tombstones( $this->visibility->hidden_ids( Pos_Visibility::CATALOG ) ) ) { | |
| 148 | + return; | |
| 149 | + } | |
| 134 | 150 | |
| 135 | 151 | // Latched even when the hidden set is empty — otherwise every request on a store that hides |
| 136 | 152 | // nothing would resolve the set again forever. |
| 137 | 153 | // Autoloaded: the Init constructor reads this latch on every request. |