SearchActor waits for transaction commit
This commit is contained in:
parent
47e67d9b64
commit
2483303138
@ -2,6 +2,8 @@ use super::Searcher;
|
|||||||
use crate::{db_conn::DbPool, posts::PostEvent, ACTOR_SYS, POST_CHAN};
|
use crate::{db_conn::DbPool, posts::PostEvent, ACTOR_SYS, POST_CHAN};
|
||||||
use riker::actors::{Actor, ActorFactoryArgs, ActorRefFactory, Context, Sender, Subscribe, Tell};
|
use riker::actors::{Actor, ActorFactoryArgs, ActorRefFactory, Context, Sender, Subscribe, Tell};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
pub struct SearchActor {
|
pub struct SearchActor {
|
||||||
@ -33,6 +35,9 @@ impl Actor for SearchActor {
|
|||||||
fn recv(&mut self, _ctx: &Context<Self::Msg>, msg: Self::Msg, _sender: Sender) {
|
fn recv(&mut self, _ctx: &Context<Self::Msg>, msg: Self::Msg, _sender: Sender) {
|
||||||
use PostEvent::*;
|
use PostEvent::*;
|
||||||
|
|
||||||
|
// Wait for transaction commited
|
||||||
|
sleep(Duration::from_millis(500));
|
||||||
|
|
||||||
match msg {
|
match msg {
|
||||||
PostPublished(post) => {
|
PostPublished(post) => {
|
||||||
let conn = self.conn.get();
|
let conn = self.conn.get();
|
||||||
|
Loading…
Reference in New Issue
Block a user