Skip to content

Commit 1b281ae

Browse files
authored
Handle tasks run by another crank turner then replaced by new tasks (simulated) (#82)
1 parent 1991175 commit 1b281ae

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tuktuk-crank-turner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tuktuk-crank-turner"
3-
version = "0.2.26"
3+
version = "0.2.27"
44
authors.workspace = true
55
edition.workspace = true
66
license.workspace = true

tuktuk-crank-turner/src/task_processor.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,19 @@ impl TimedTask {
289289
{
290290
info!(?self.task_key, "task was already replaced, skipping");
291291
}
292+
TransactionQueueError::SimulatedTransactionError(
293+
TransactionError::InstructionError(_, InstructionError::Custom(code)),
294+
) if code == 6005
295+
&& ctx
296+
.rpc_client
297+
.anchor_account::<TaskV0>(&self.task_key)
298+
.await
299+
.ok()
300+
.flatten()
301+
.is_some_and(|acc| acc.queued_at != self.task.queued_at) =>
302+
{
303+
info!(?self.task_key, "task was already replaced, skipping");
304+
}
292305
TransactionQueueError::RawTransactionError(_)
293306
| TransactionQueueError::SimulatedTransactionError(_)
294307
| TransactionQueueError::TransactionError(_)

0 commit comments

Comments
 (0)