mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Introduce a ProcessingTasks constructor
This commit is contained in:
parent
b373d19831
commit
6e904d0997
@ -128,6 +128,14 @@ struct ProcessingTasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ProcessingTasks {
|
impl ProcessingTasks {
|
||||||
|
/// Creates an empty `ProcessingAt` struct.
|
||||||
|
fn new() -> ProcessingTasks {
|
||||||
|
ProcessingTasks {
|
||||||
|
started_at: OffsetDateTime::now_utc(),
|
||||||
|
processing: RoaringBitmap::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Stores the currently processing tasks, and the date time at which it started.
|
/// Stores the currently processing tasks, and the date time at which it started.
|
||||||
fn start_processing_at(&mut self, started_at: OffsetDateTime, processing: RoaringBitmap) {
|
fn start_processing_at(&mut self, started_at: OffsetDateTime, processing: RoaringBitmap) {
|
||||||
self.started_at = started_at;
|
self.started_at = started_at;
|
||||||
@ -242,16 +250,12 @@ impl IndexScheduler {
|
|||||||
options.max_dbs(6);
|
options.max_dbs(6);
|
||||||
|
|
||||||
let env = options.open(tasks_path)?;
|
let env = options.open(tasks_path)?;
|
||||||
let processing_tasks = ProcessingTasks {
|
|
||||||
started_at: OffsetDateTime::now_utc(),
|
|
||||||
processing: RoaringBitmap::new(),
|
|
||||||
};
|
|
||||||
let file_store = FileStore::new(&update_file_path)?;
|
let file_store = FileStore::new(&update_file_path)?;
|
||||||
|
|
||||||
// allow unreachable_code to get rids of the warning in the case of a test build.
|
// allow unreachable_code to get rids of the warning in the case of a test build.
|
||||||
let this = Self {
|
let this = Self {
|
||||||
must_stop_processing: MustStopProcessing::default(),
|
must_stop_processing: MustStopProcessing::default(),
|
||||||
processing_tasks: Arc::new(RwLock::new(processing_tasks)),
|
processing_tasks: Arc::new(RwLock::new(ProcessingTasks::new())),
|
||||||
file_store,
|
file_store,
|
||||||
all_tasks: env.create_database(Some(db_name::ALL_TASKS))?,
|
all_tasks: env.create_database(Some(db_name::ALL_TASKS))?,
|
||||||
status: env.create_database(Some(db_name::STATUS))?,
|
status: env.create_database(Some(db_name::STATUS))?,
|
||||||
|
Loading…
Reference in New Issue
Block a user