diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-07 12:34:59 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-07 12:34:59 +0000 |
| commit | d78d3a86ba81a5b59cde527a448f5c9d131db8d6 (patch) | |
| tree | bd197adb274fb19513a15429ebbe77f760e39508 /src/purgatory/sync | |
| parent | e72edbae86affcb9fc0429bd197639bf438ffb6c (diff) | |
Refactor handle_receive_pack to use unified process_newly_available_git_data
Replace ~100 lines of duplicated post-push processing in handle_receive_pack
with a single call to the unified process_newly_available_git_data function.
The unified function handles all post-git-data-available processing:
- Discovering satisfiable events from purgatory (state and PR events)
- Syncing OIDs to authorized owner repos
- Aligning refs (+ setting HEAD) in all owner repos
- Saving events to database
- Notifying WebSocket subscribers
- Removing from purgatory
This ensures consistent behavior regardless of how git data arrives
(git push vs purgatory sync fetching from remote servers).
Also mark test-only internal methods with #[cfg(test)] to silence
dead code warnings.
Diffstat (limited to 'src/purgatory/sync')
| -rw-r--r-- | src/purgatory/sync/throttle.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/purgatory/sync/throttle.rs b/src/purgatory/sync/throttle.rs index a310a91..05b0878 100644 --- a/src/purgatory/sync/throttle.rs +++ b/src/purgatory/sync/throttle.rs | |||
| @@ -343,6 +343,7 @@ impl ThrottleManager { | |||
| 343 | /// | 343 | /// |
| 344 | /// Decrements in-flight count and cleans up old timestamps. | 344 | /// Decrements in-flight count and cleans up old timestamps. |
| 345 | /// Does not trigger processing of queued identifiers. | 345 | /// Does not trigger processing of queued identifiers. |
| 346 | #[cfg(test)] | ||
| 346 | fn complete_request_internal(&self, domain: &str) { | 347 | fn complete_request_internal(&self, domain: &str) { |
| 347 | if let Some(entry) = self.throttles.get(domain) { | 348 | if let Some(entry) = self.throttles.get(domain) { |
| 348 | let mut throttle = entry.lock().unwrap(); | 349 | let mut throttle = entry.lock().unwrap(); |
| @@ -377,6 +378,7 @@ impl ThrottleManager { | |||
| 377 | /// | 378 | /// |
| 378 | /// If the identifier is already queued for this domain, merges the tried_urls sets. | 379 | /// If the identifier is already queued for this domain, merges the tried_urls sets. |
| 379 | /// Does not trigger processing. | 380 | /// Does not trigger processing. |
| 381 | #[cfg(test)] | ||
| 380 | fn enqueue_identifier_internal( | 382 | fn enqueue_identifier_internal( |
| 381 | &self, | 383 | &self, |
| 382 | domain: &str, | 384 | domain: &str, |