Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tuktuk-crank-turner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tuktuk-crank-turner"
version = "0.2.25"
version = "0.2.26"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
24 changes: 21 additions & 3 deletions tuktuk-crank-turner/src/task_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use solana_sdk::{instruction::InstructionError, signer::Signer, transaction::Tra
use solana_transaction_utils::{error::Error as TransactionQueueError, queue::TransactionTask};
use tokio_graceful_shutdown::SubsystemHandle;
use tracing::{debug, info};
use tuktuk_program::TaskQueueV0;
use tuktuk_sdk::compiled_transaction::{
next_available_task_ids_excluding_in_progress, run_ix_with_free_tasks,
use tuktuk_program::{TaskQueueV0, TaskV0};
use tuktuk_sdk::{
client::GetAnchorAccount,
compiled_transaction::{next_available_task_ids_excluding_in_progress, run_ix_with_free_tasks},
};

use crate::{
Expand Down Expand Up @@ -271,6 +272,23 @@ impl TimedTask {
)) if code == 3012 && ctx.rpc_client.get_account(&self.task_key).await.is_err() => {
info!(?self.task_key, "task not found, removing from queue");
}
// Handle task not ready
// There's a race condition where the task was already completed and replaced with a new one,
// yet we're still trying to process the old task.
TransactionQueueError::TransactionError(TransactionError::InstructionError(
_,
InstructionError::Custom(code),
)) if code == 6005
&& ctx
.rpc_client
.anchor_account::<TaskV0>(&self.task_key)
.await
.ok()
.flatten()
.is_some_and(|acc| acc.queued_at != self.task.queued_at) =>
{
info!(?self.task_key, "task was already replaced, skipping");
}
TransactionQueueError::RawTransactionError(_)
| TransactionQueueError::SimulatedTransactionError(_)
| TransactionQueueError::TransactionError(_)
Expand Down