@@ -1706,15 +1706,16 @@ fn events_insert_tails(source: &str) -> Vec<String> {
17061706 tails
17071707}
17081708
1709- /// An events insert must run both follow-ups : the push enqueue and the
1710- /// pre-commit TTL refresh. `after_admitted_insert` does both; a writer that
1711- /// inserts inside a savepoint calls the two halves separately.
1709+ /// An events insert must run every follow-up : the push enqueue, the search
1710+ /// outbox row and the pre-commit TTL refresh. `after_admitted_insert` does
1711+ /// all three; a writer that inserts inside a savepoint calls them separately.
17121712///
17131713/// Only real calls count: a hook in a comment or a string literal does not.
17141714fn runs_event_follow_ups ( function_source : & str ) -> bool {
17151715 let code = mask_comments_and_literals ( function_source) ;
17161716 code. contains ( "event_follow_up::after_admitted_insert(" )
17171717 || ( code. contains ( "event_follow_up::enqueue_push_match(" )
1718+ && code. contains ( "search_outbox::enqueue_in_transaction(" )
17181719 && code. contains ( ".record_channel_event(" ) )
17191720}
17201721
@@ -1759,6 +1760,16 @@ pub(crate) async fn hooked_writer(tx: &mut AdmittedTx) {
17591760 .await
17601761 .expect("follow up");
17611762}
1763+ pub(crate) async fn unsearched_writer(tx: &mut AdmittedTx) {
1764+ sqlx::query("INSERT INTO events (community_id, id) VALUES ($1, $2)")
1765+ .execute(tx.conn())
1766+ .await
1767+ .expect("write");
1768+ crate::store::event_follow_up::enqueue_push_match(tx.conn(), community, id, kind)
1769+ .await
1770+ .expect("enqueue");
1771+ tx.record_channel_event(channel, kind);
1772+ }
17621773pub(crate) async fn savepoint_writer(tx: &mut AdmittedTx) {
17631774 sqlx::query("INSERT INTO events (community_id, id) VALUES ($1, $2)")
17641775 .execute(tx.conn())
@@ -1767,6 +1778,9 @@ pub(crate) async fn savepoint_writer(tx: &mut AdmittedTx) {
17671778 crate::store::event_follow_up::enqueue_push_match(tx.conn(), community, id, kind)
17681779 .await
17691780 .expect("enqueue");
1781+ crate::search_outbox::enqueue_in_transaction(tx, id, created_at, kind)
1782+ .await
1783+ .expect("search");
17701784 tx.record_channel_event(channel, kind);
17711785}
17721786pub(crate) async fn mention_writer(tx: &mut AdmittedTx) {
@@ -1900,6 +1914,7 @@ mod tests {
19001914 "pub(crate) async fn unhooked_writer(tx: &mut AdmittedTx) {" ,
19011915 "pub(crate) async fn quoted_writer(tx: &mut AdmittedTx) {" ,
19021916 "pub(crate) async fn push_only_writer(tx: &mut AdmittedTx) {" ,
1917+ "pub(crate) async fn unsearched_writer(tx: &mut AdmittedTx) {" ,
19031918 "pub(crate) async fn lowercase_writer(tx: &mut AdmittedTx) {" ,
19041919 "pub(crate) async fn continued_writer(tx: &mut AdmittedTx) {" ,
19051920 "pub(crate) async fn writer_under_doc_mention(tx: &mut AdmittedTx) {" ,
@@ -1915,7 +1930,7 @@ mod tests {
19151930 "pub(crate) async fn writer_after_raw_string_example(tx: &mut AdmittedTx) {" ,
19161931 "pub(crate) async fn writer_after_test_helper(tx: &mut AdmittedTx) {" ,
19171932 ] ,
1918- "an events insert must run the push enqueue and record the TTL refresh"
1933+ "an events insert must run the push enqueue, queue the search row and record the TTL refresh"
19191934 ) ;
19201935}
19211936
0 commit comments