forked from jmug/stoatchat
feat: initial work on elasticsearch integration
Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
use revolt_config::capture_error;
|
||||
use revolt_database::{AMQP, Database};
|
||||
|
||||
|
||||
pub async fn index_existing_messages(db: Database, amqp: AMQP) {
|
||||
let mut generator = db.fetch_all_messages().await.expect("Database query failed");
|
||||
|
||||
while let Some(message) = generator.next().await {
|
||||
if let Err(e) = amqp.new_message_search(message).await {
|
||||
log::error!("Error pushing message to RabbitMQ: {e}");
|
||||
capture_error(&e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user