gzip the tasks

This commit is contained in:
Tamo 2023-11-29 13:09:04 +01:00 committed by Clément Renault
parent 547379abb0
commit be72326c0a
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
4 changed files with 12 additions and 4 deletions

View file

@ -45,6 +45,8 @@ use dump::{KindDump, TaskDump, UpdateFile};
pub use error::Error;
pub use features::RoFeatures;
use file_store::FileStore;
use flate2::bufread::GzEncoder;
use flate2::Compression;
use meilisearch_types::error::ResponseError;
use meilisearch_types::features::{InstanceTogglableFeatures, RuntimeTogglableFeatures};
use meilisearch_types::heed::byteorder::BE;
@ -1288,7 +1290,10 @@ impl IndexScheduler {
buffer.push(b'\n');
}
let _ = ureq::post(url).send_bytes(&buffer).unwrap();
let reader = GzEncoder::new(&buffer[..], Compression::default());
if let Err(e) = ureq::post(url).set("Content-Encoding", "gzip").send(reader) {
log::error!("While sending data to the webhook: {e}");
}
}
Ok(())