Fix most of the easy issues

This commit is contained in:
Clément Renault 2025-06-30 18:31:32 +02:00
parent 7219299436
commit 85037352b9
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
6 changed files with 39 additions and 16 deletions

View file

@ -178,8 +178,8 @@ make_enum_progress! {
make_enum_progress! {
pub enum Export {
EnsuringCorrectnessOfTheTarget,
ExportTheSettings,
ExportTheDocuments,
ExporingTheSettings,
ExporingTheDocuments,
}
}

View file

@ -510,9 +510,9 @@ impl IndexScheduler {
// 3. we batch the export.
let to_export = self.queue.tasks.get_kind(rtxn, Kind::Export)? & enqueued;
if !to_export.is_empty() {
let mut tasks = self.queue.tasks.get_existing_tasks(rtxn, to_export)?;
current_batch.processing(&mut tasks);
let task = tasks.pop().expect("There must be only one export task");
let task_id = to_export.iter().next().expect("There must be only one export task");
let mut task = self.queue.tasks.get_task(rtxn, task_id)?.unwrap();
current_batch.processing([&mut task]);
current_batch.reason(BatchStopReason::TaskKindCannotBeBatched { kind: Kind::Export });
return Ok(Some((Batch::Export { task }, current_batch)));
}

View file

@ -86,10 +86,11 @@ impl IndexScheduler {
}
// Retry logic for sending settings
let url = format!("{base_url}/indexes/{uid}/settings");
let bearer = api_key.map(|api_key| format!("Bearer {api_key}"));
retry(&must_stop_processing, || {
let mut request = agent.patch(&url);
if let Some(api_key) = api_key {
request = request.set("Authorization", &format!("Bearer {api_key}"));
if let Some(bearer) = bearer.as_ref() {
request = request.set("Authorization", bearer);
}
request.send_json(settings.clone()).map_err(into_backoff_error)
})?;

View file

@ -273,7 +273,7 @@ pub fn swap_index_uid_in_task(task: &mut Task, swap: (&str, &str)) {
K::TaskCancelation { .. }
| K::TaskDeletion { .. }
| K::DumpCreation { .. }
| K::Export { .. } // TODO I have patterns, not index uids
| K::Export { .. }
| K::UpgradeDatabase { .. }
| K::SnapshotCreation => (),
};