Skip to content

Commit

Permalink
fix: fix type id not matched error (worker stdio concurrent error)
Browse files Browse the repository at this point in the history
  • Loading branch information
raindust committed Dec 24, 2023
1 parent c3ca345 commit b729266
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions actorx/src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,13 @@ impl Worker {
mut input: Receiver<(Operation, u64)>,
) -> Result<()> {
let mut first = true;
let mut state_write = state.write().await;

while let Some((operation, mut gas)) = input.recv().await {
let mut state_write = state.write().await;
let instance = state_write.instance();

let resp = if first {
first = false;
let op = operation.clone();
match instance.invoke(op, Some(&mut gas)) {
match state_write.instance().invoke(op, Some(&mut gas)) {
Ok(r) => r,
Err(e) => {
println!("Worker channel fails due to {e:?}, restarting...");
Expand All @@ -196,10 +194,13 @@ impl Worker {
}
}
} else {
instance.invoke(operation, Some(&mut gas)).map_err(|e| {
println!("Worker channel (cid {cid}) invoke fails due to {e:?}");
e
})?
state_write
.instance()
.invoke(operation, Some(&mut gas))
.map_err(|e| {
println!("Worker channel (cid {cid}) invoke fails due to {e:?}");
e
})?
};

let is_completed = !matches!(resp, Operation::Call { .. });
Expand Down

0 comments on commit b729266

Please sign in to comment.