Skip to content

Commit

Permalink
fixed merge, beam methods don't return bool
Browse files Browse the repository at this point in the history
  • Loading branch information
enola-dkfz committed Feb 14, 2024
1 parent d0b5cd3 commit 6108d3e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/beam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ pub async fn retrieve_tasks() -> Result<Vec<TaskRequest<String>>, FocusError> {
.map_err(FocusError::UnableToRetrieveTasksHttp)
}

pub async fn answer_task<T: Serialize + 'static>(result: &TaskResult<T>) -> Result<bool, FocusError> {
pub async fn answer_task<T: Serialize + 'static>(result: &TaskResult<T>) -> Result<(), FocusError> {
debug!("Answer task with id: {}", result.task);
BEAM_CLIENT.put_result(result, &result.task)
.await
.map_err(FocusError::UnableToAnswerTask)
.await
.map(|_| ())
.or_else(|e| match e {
beam_lib::BeamError::UnexpectedStatus(s) if s == StatusCode::NOT_FOUND => Ok(()),
other => Err(FocusError::UnableToAnswerTask(other))
})
}

pub async fn fail_task<T>(task: &TaskRequest<T>, body: impl Into<String>) -> Result<(), FocusError> {
Expand Down

0 comments on commit 6108d3e

Please sign in to comment.