diff options
Diffstat (limited to 'src/sync')
| -rw-r--r-- | src/sync/mod.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/sync/mod.rs b/src/sync/mod.rs index b56b6b7..7d60ea4 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs | |||
| @@ -1046,6 +1046,40 @@ impl SyncManager { | |||
| 1046 | } | 1046 | } |
| 1047 | } | 1047 | } |
| 1048 | 1048 | ||
| 1049 | // For sync-triggered events that go to purgatory, trigger immediate sync | ||
| 1050 | // (instead of the default 3-minute delay for user-submitted events) | ||
| 1051 | if result == ProcessResult::Purgatory { | ||
| 1052 | // State events (kind 30618) - extract identifier and trigger immediate sync | ||
| 1053 | if event.kind.as_u16() == 30618 { | ||
| 1054 | if let Some(identifier) = event.tags.iter().find_map(|tag| { | ||
| 1055 | let tag_vec = tag.clone().to_vec(); | ||
| 1056 | if tag_vec.len() >= 2 && tag_vec[0] == "d" { | ||
| 1057 | Some(tag_vec[1].clone()) | ||
| 1058 | } else { | ||
| 1059 | None | ||
| 1060 | } | ||
| 1061 | }) { | ||
| 1062 | tracing::debug!( | ||
| 1063 | event_id = %event.id, | ||
| 1064 | identifier = %identifier, | ||
| 1065 | "Triggering immediate sync for synced state event in purgatory" | ||
| 1066 | ); | ||
| 1067 | write_policy.purgatory().enqueue_sync_immediate(&identifier); | ||
| 1068 | } | ||
| 1069 | } | ||
| 1070 | // PR events (kind 1617/1618) - extract identifier from 'a' tag | ||
| 1071 | else if event.kind.as_u16() == 1617 || event.kind.as_u16() == 1618 { | ||
| 1072 | if let Some(identifier) = crate::git::sync::extract_identifier_from_pr_event(&event) { | ||
| 1073 | tracing::debug!( | ||
| 1074 | event_id = %event.id, | ||
| 1075 | identifier = %identifier, | ||
| 1076 | "Triggering immediate sync for synced PR event in purgatory" | ||
| 1077 | ); | ||
| 1078 | write_policy.purgatory().enqueue_sync_immediate(&identifier); | ||
| 1079 | } | ||
| 1080 | } | ||
| 1081 | } | ||
| 1082 | |||
| 1049 | // Track pagination state for this subscription | 1083 | // Track pagination state for this subscription |
| 1050 | if result == ProcessResult::Saved || result == ProcessResult::Duplicate { | 1084 | if result == ProcessResult::Saved || result == ProcessResult::Duplicate { |
| 1051 | let mut pending = pending_sync_index.write().await; | 1085 | let mut pending = pending_sync_index.write().await; |