Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message processing warts #3458

Open
3 tasks
aatifsyed opened this issue Sep 5, 2023 · 0 comments
Open
3 tasks

message processing warts #3458

aatifsyed opened this issue Sep 5, 2023 · 0 comments
Labels
Priority: 4 - Low Limited impact and can be implemented at any time Type: Enhancement

Comments

@aatifsyed
Copy link
Contributor

  • Document why it's ok to ignore the cron error:
    if let Err(e) = self.run_cron(epoch, callback.as_mut()) {
    tracing::error!("End of epoch cron failed to run: {}", e);
    }
  • Consider inlining message processing:
    let mut process_msg = |msg: &ChainMessage| -> Result<(), anyhow::Error> {
  • Refactor callback for message replay:
    const ERROR_MSG: &str = "replay_halt";
    // This isn't ideal to have, since the execution is synchronous, but this needs
    // to be the case because the state transition has to be in blocking
    // thread to avoid starving executor
    let (m_tx, m_rx) = std::sync::mpsc::channel();
    let (r_tx, r_rx) = std::sync::mpsc::channel();
    let callback = move |cid: &Cid, unsigned: &ChainMessage, apply_ret: &ApplyRet| {
    if *cid == mcid {
    m_tx.send(unsigned.message().clone())?;
    r_tx.send(apply_ret.clone())?;
    anyhow::bail!(ERROR_MSG);
    }
    Ok(())
    };
    let result = self
    .compute_tipset_state(Arc::clone(ts), Some(callback))
    .await;
    if let Err(error_message) = result {
    if error_message.to_string() != ERROR_MSG {
    return Err(Error::Other(format!(
    "unexpected error during execution : {error_message:}"
    )));
    }
    }
    • Callback should return ControlFlow, not Result if it's going to break.
@lemmih lemmih added Priority: 4 - Low Limited impact and can be implemented at any time Type: Enhancement labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 4 - Low Limited impact and can be implemented at any time Type: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants