Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justcoon committed Apr 2, 2024
1 parent 5604fab commit 48fcaa1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion golem-service-base/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use golem_common::model::{parse_function_name, ShardId, TemplateId, WorkerFilter
use golem_wasm_ast::analysis::{AnalysedResourceId, AnalysedResourceMode};
use http::Uri;
use poem_openapi::{Enum, NewType, Object, Union};
use rand::seq::IteratorRandom;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{collections::HashMap, fmt::Display, fmt::Formatter};

Expand Down Expand Up @@ -3100,7 +3101,6 @@ impl RoutingTable {
}

pub fn random(&self) -> Option<&Pod> {
use rand::seq::IteratorRandom;
self.shard_assignments
.values()
.choose(&mut rand::thread_rng())
Expand Down
2 changes: 1 addition & 1 deletion golem-worker-service-base/src/service/worker/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ where
workers, cursor })),
} => {
let cursor: Option<u64> = if cursor == 0 { None } else { Some(cursor) };
let workers = workers.iter().map(| w| w.clone().try_into()).collect::<Result<Vec<_>, _>>().map_err(|_| GolemError::Unknown(GolemErrorUnknown {
let workers = workers.into_iter().map(| w| w.try_into()).collect::<Result<Vec<_>, _>>().map_err(|_| GolemError::Unknown(GolemErrorUnknown {
details: "Convert response error".to_string(),
}))?;
Ok((cursor, workers))
Expand Down
3 changes: 1 addition & 2 deletions golem-worker-service/src/grpcapi/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ impl WorkerGrpcApi {
)
.await?;

let result: Vec<WorkerMetadata> =
workers.iter().map(|worker| worker.clone().into()).collect();
let result: Vec<WorkerMetadata> = workers.into_iter().map(|worker| worker.into()).collect();

Ok((new_cursor, result))
}
Expand Down

0 comments on commit 48fcaa1

Please sign in to comment.