pub fn refresh_resend_tasks(&mut self) {

        // Remove all resend tasks (we will create them anew)
        {
            let mut t: Vec<Task> = vec![]; // temp holding for tasks to delete
            for task in &self.tasks {
                if task.tasktype==TaskType::Resend {
                    t.push(task.clone());
                }
            }
            for task in &t {
                let _ = self.tasks.remove(task);
            }
        }

        // Load the incomplete (queued and/or deferred) email statuses, for tasking
        if let Ok(guard) = (*self.storage).write() {
            if let Ok(mut isvec) = (*guard).retrieve_all_incomplete() {
                // Create one task for each queued/deferred email
                for is in isvec.drain(..) {
                    self.tasks.insert(Task {
                        tasktype: TaskType::Resend,
                        time: Instant::now(),
                        message_id: is.message_id.clone(),
                    });
                }
            } else {
                *self.worker_status.write().unwrap() = WorkerStatus::StorageReadFailed as u8;
            }
        } else {
            *self.worker_status.write().unwrap() = WorkerStatus::LockPoisoned as u8;
        }

        self.last_refresh = Instant::now();
    }
// Sometimes other processes queue mail into Storage w/o the ability to message
// us. So we periodically reread storage and refresh our resend tasks
Sometimes other processes queue mail into Storage w/o the ability to message
us. So we periodically reread storage and refresh our resend tasks
Sometimes other processes queue mail into Storage w / o the ability to message us . So we periodically reread storage and refresh our resend tasks
pub fn refresh_resend_tasks(&mut self) {
        // Remove all resend tasks (we will create them anew)
        {
            let mut t: Vec<Task> = vec![]; // temp holding for tasks to delete
            for task in &self.tasks {
                if task.tasktype==TaskType::Resend {
                    t.push(task.clone());
                }
            }
            for task in &t {
                let _ = self.tasks.remove(task);
            }
        }
        // Load the incomplete (queued and/or deferred) email statuses, for tasking
        if let Ok(guard) = (*self.storage).write() {
            if let Ok(mut isvec) = (*guard).retrieve_all_incomplete() {
                // Create one task for each queued/deferred email
                for is in isvec.drain(..) {
                    self.tasks.insert(Task {
                        tasktype: TaskType::Resend,
                        time: Instant::now(),
                        message_id: is.message_id.clone(),
                    });
                }
            } else {
                *self.worker_status.write().unwrap() = WorkerStatus::StorageReadFailed as u8;
            }
        } else {
            *self.worker_status.write().unwrap() = WorkerStatus::LockPoisoned as u8;
        }
        self.last_refresh = Instant::now();
    }
pub fn refresh_resend_tasks ( & mut self ) { // Remove all resend tasks (we will create them anew) { let mut t : Vec < Task > = vec ! [ ] ; // temp holding for tasks to delete for task in & self . tasks { if task . tasktype == TaskType :: Resend { t . push ( task . clone ( ) ) ; } } for task in & t { let _ = self . tasks . remove ( task ) ; } } // Load the incomplete (queued and/or deferred) email statuses, for tasking if let Ok ( guard ) = ( * self . storage ) . write ( ) { if let Ok ( mut isvec ) = ( * guard ) . retrieve_all_incomplete ( ) { // Create one task for each queued/deferred email for is in isvec . drain ( .. ) { self . tasks . insert ( Task { tasktype : TaskType :: Resend , time : Instant :: now ( ) , message_id : is . message_id . clone ( ) , } ) ; } } else { * self . worker_status . write ( ) . unwrap ( ) = WorkerStatus :: StorageReadFailed as u8 ; } } else { * self . worker_status . write ( ) . unwrap ( ) = WorkerStatus :: LockPoisoned as u8 ; } self . last_refresh = Instant :: now ( ) ; }
Sometimes other processes queue mail into Storage w/o the ability to message
us.
Sometimes other processes queue mail into Storage w / o the ability to message us .
&mut self
&mut self