Commit 8f94ebc
refactor(storage): remove fire-and-forget auto-publish from content POST
The drain loop is now the sole publisher of EPR Heads to Kademlia.
The previous tokio::spawn auto-publish bypassed the peer gate and
silently 'succeeded' into empty Kad on writes before peers connected —
creating phantom published state. It also didn't set p2p_published_at,
which created a visibility inconsistency after Phase A: new content
was DHT-published but stayed gated from external reads until the drain
tick.
After this change:
- POST /db/content and POST /db/content/bulk only write to SQLite;
DHT publish happens via the next drain_interval tick (within ~15s).
- Content is visible to external reads once the drain has marked it.
- The seeder should poll /p2p/publish-state (Task E1) until pending=0
to confirm drain completion before treating seeding as done.
P2PHandle::publish_epr_head and P2PCommand::PublishEprHead are now
unused but retained with #[allow(dead_code)] as part of the P2PHandle
abstraction for potential future use.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b07686c commit 8f94ebc
2 files changed
+19
-120
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2174 | 2174 | | |
2175 | 2175 | | |
2176 | 2176 | | |
2177 | | - | |
2178 | | - | |
2179 | | - | |
2180 | | - | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
2185 | | - | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
2192 | | - | |
2193 | | - | |
2194 | 2177 | | |
2195 | 2178 | | |
2196 | 2179 | | |
| |||
2206 | 2189 | | |
2207 | 2190 | | |
2208 | 2191 | | |
2209 | | - | |
2210 | | - | |
2211 | | - | |
2212 | | - | |
2213 | | - | |
2214 | | - | |
2215 | | - | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
2221 | | - | |
2222 | | - | |
2223 | | - | |
2224 | | - | |
2225 | | - | |
2226 | | - | |
2227 | | - | |
2228 | | - | |
2229 | | - | |
2230 | | - | |
2231 | | - | |
2232 | | - | |
2233 | | - | |
2234 | | - | |
2235 | | - | |
2236 | | - | |
2237 | | - | |
2238 | | - | |
2239 | | - | |
2240 | | - | |
2241 | | - | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
2245 | | - | |
2246 | | - | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
2247 | 2195 | | |
2248 | 2196 | | |
2249 | 2197 | | |
| |||
2377 | 2325 | | |
2378 | 2326 | | |
2379 | 2327 | | |
2380 | | - | |
2381 | | - | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
2385 | | - | |
2386 | | - | |
2387 | | - | |
2388 | | - | |
2389 | | - | |
2390 | | - | |
2391 | | - | |
2392 | | - | |
2393 | | - | |
2394 | | - | |
2395 | | - | |
2396 | | - | |
2397 | | - | |
2398 | | - | |
2399 | | - | |
2400 | | - | |
2401 | 2328 | | |
2402 | 2329 | | |
2403 | 2330 | | |
| |||
2420 | 2347 | | |
2421 | 2348 | | |
2422 | 2349 | | |
2423 | | - | |
2424 | | - | |
2425 | | - | |
2426 | | - | |
2427 | | - | |
2428 | | - | |
2429 | | - | |
2430 | | - | |
2431 | | - | |
2432 | | - | |
2433 | | - | |
2434 | | - | |
2435 | | - | |
2436 | | - | |
2437 | | - | |
2438 | | - | |
2439 | | - | |
2440 | | - | |
2441 | | - | |
2442 | | - | |
2443 | | - | |
2444 | | - | |
2445 | | - | |
2446 | | - | |
2447 | | - | |
2448 | | - | |
2449 | | - | |
2450 | | - | |
2451 | | - | |
2452 | | - | |
2453 | | - | |
2454 | | - | |
2455 | | - | |
2456 | | - | |
2457 | | - | |
2458 | | - | |
2459 | | - | |
2460 | | - | |
2461 | | - | |
2462 | | - | |
2463 | | - | |
2464 | | - | |
2465 | | - | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
2466 | 2354 | | |
2467 | 2355 | | |
2468 | 2356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
242 | 247 | | |
243 | 248 | | |
244 | 249 | | |
| |||
287 | 292 | | |
288 | 293 | | |
289 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
290 | 301 | | |
291 | 302 | | |
292 | 303 | | |
| |||
0 commit comments