Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions manager/src/state/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,26 @@ impl State for FileStore {
pending_file_path.push(task_id);

match task.get_status() {
TaskStatus::TASK_UNKNOWN => return Ok(()),
TaskStatus::TASK_IN_PROGRESS => return Ok(()),
TaskStatus::TASK_UNKNOWN => Ok(()),
TaskStatus::TASK_IN_PROGRESS => Ok(()),
TaskStatus::TASK_PENDING => {
File::create(pending_file_path)
.context(StateErrorKind::PendingTaskWriteFailed)?
.write_all(&task_id.as_bytes())
.context(StateErrorKind::PendingTaskWriteFailed)?;
Ok(())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these can be removed if you remove the semicolon on the previous lines

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following error when I do this:

error[E0308]: match arms have incompatible types
   --> manager/src/state/file.rs:138:17
    |
138 | /                 File::create(pending_file_path)
139 | |                     .context(StateErrorKind::PendingTaskWriteFailed)?
140 | |                     .write_all(&task_id.as_bytes())
141 | |                     .context(StateErrorKind::PendingTaskWriteFailed)?
    | |_____________________________________________________________________^ expected enum `std::result::Result`, found ()
    |
    = note: expected type `std::result::Result<(), state::StateError>`
               found type `()`

Copy link
Member Author

@VoyTechnology VoyTechnology Apr 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would I just wrap the whole statement in Ok(...)?

}
TaskStatus::TASK_DONE => {
fs::remove_file(pending_file_path)
.context(StateErrorKind::PendingTaskRemoveFailed)?;
Ok(())
}
TaskStatus::TASK_FAILED => {
// TODO: Do we want to remove the pending file if the task
// fails or do we keep it?
Ok(())
}
}

Ok(())
}

fn pending_map_tasks(&self, job: &Job) -> Result<Vec<Task>, StateError> {
Expand Down