mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-23 18:40:34 +00:00
SearchActor waits for transaction commit
This commit is contained in:
parent
47e67d9b64
commit
2483303138
1 changed files with 5 additions and 0 deletions
|
@ -2,6 +2,8 @@ use super::Searcher;
|
|||
use crate::{db_conn::DbPool, posts::PostEvent, ACTOR_SYS, POST_CHAN};
|
||||
use riker::actors::{Actor, ActorFactoryArgs, ActorRefFactory, Context, Sender, Subscribe, Tell};
|
||||
use std::sync::Arc;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use tracing::error;
|
||||
|
||||
pub struct SearchActor {
|
||||
|
@ -33,6 +35,9 @@ impl Actor for SearchActor {
|
|||
fn recv(&mut self, _ctx: &Context<Self::Msg>, msg: Self::Msg, _sender: Sender) {
|
||||
use PostEvent::*;
|
||||
|
||||
// Wait for transaction commited
|
||||
sleep(Duration::from_millis(500));
|
||||
|
||||
match msg {
|
||||
PostPublished(post) => {
|
||||
let conn = self.conn.get();
|
||||
|
|
Loading…
Reference in a new issue