Skip to content

Commit 6f6f765

Browse files
authored
feat: Plat-6684 add support for transaction entries expiration (#394)
* chore: initial * feat: add repos logic and config processing logic * chore: fixes * chore: imprve env sync_nonce and add service info log * chore: lint * chore: add notifications crud endpoints * chore: add notification request validations * chore: initial work for notificaitons crud * chore: fix openapi generation * chore: improvements * chore: improvements * chore: improvements * chore: impr * chore: intial signers crud impl * chore: improvements * chore: refactor * chore: impr * refactor + remove vault cloud due to deprecation of service * chore: impr * chore: fix clippy * chore: fixes * chore: add noboost comments * chore: typo * chore: stellar * chore: noboost * feat: plat-6845 implement relayer models * chore: improvements * chore: improvements * chore: impr * chore: implement merge patch logic for relayer * chore: improvements * chore: improvements * chore: impr * chore: clippy * chore: cleanup * chore: add controller tests * chore: more contrller tests * chore: resolve bug * chore: tests * chore: more tests * chore: fixes * chore: impr * chore: add nosemgrep rule * feat: securely store secrets in storage * chore: allow starting service with empty config * chore: improvements * chore: clippy * chore: pr suggestions * chore: impr * chore: improvements * chore: format * chore: improvements * feat: plat-6864 impre response schema and revert some model name changes to avoid sdk breaking changes * feat: add support for transaction expiration * chore: clippy * chore: leftover
1 parent f5df1a3 commit 6f6f765

21 files changed

Lines changed: 2627 additions & 118 deletions

File tree

src/api/routes/relayer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ mod tests {
322322
network_type: NetworkType::Evm,
323323
noop_count: None,
324324
is_canceled: Some(false),
325+
delete_at: None,
325326
};
326327
transaction_repo.create(test_transaction).await.unwrap();
327328

src/bootstrap/initialize_workers.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use tokio::signal::unix::SignalKind;
1212
use crate::{
1313
jobs::{
1414
notification_handler, solana_token_swap_cron_handler, solana_token_swap_request_handler,
15-
transaction_request_handler, transaction_status_handler, transaction_submission_handler,
16-
BackoffRetryPolicy,
15+
transaction_cleanup_handler, transaction_request_handler, transaction_status_handler,
16+
transaction_submission_handler, BackoffRetryPolicy,
1717
},
1818
models::DefaultAppState,
1919
repositories::RelayerRepository,
@@ -29,6 +29,7 @@ const TRANSACTION_SENDER: &str = "transaction_sender";
2929
const TRANSACTION_STATUS_CHECKER: &str = "transaction_status_checker";
3030
const NOTIFICATION_SENDER: &str = "notification_sender";
3131
const SOLANA_TOKEN_SWAP_REQUEST: &str = "solana_token_swap_request";
32+
const TRANSACTION_CLEANUP: &str = "transaction_cleanup";
3233

3334
pub async fn initialize_workers(app_state: ThinData<DefaultAppState>) -> Result<()> {
3435
let queue = app_state.job_producer.get_queue().await?;
@@ -88,12 +89,27 @@ pub async fn initialize_workers(app_state: ThinData<DefaultAppState>) -> Result<
8889
.backend(queue.solana_token_swap_request_queue.clone())
8990
.build_fn(solana_token_swap_request_handler);
9091

92+
let transaction_cleanup_queue_worker = WorkerBuilder::new(TRANSACTION_CLEANUP)
93+
.layer(ErrorHandlingLayer::new())
94+
.enable_tracing()
95+
.catch_panic()
96+
.rate_limit(DEFAULT_RATE_LIMIT, DEFAULT_RATE_LIMIT_DURATION)
97+
.retry(BackoffRetryPolicy::default())
98+
.concurrency(1)
99+
.data(app_state.clone())
100+
.backend(CronStream::new(
101+
// every 30 minutes
102+
apalis_cron::Schedule::from_str("0 */30 * * * *").unwrap(),
103+
))
104+
.build_fn(transaction_cleanup_handler);
105+
91106
let monitor = Monitor::new()
92107
.register(transaction_request_queue_worker)
93108
.register(transaction_submission_queue_worker)
94109
.register(transaction_status_queue_worker)
95110
.register(notification_queue_worker)
96111
.register(solana_token_swap_request_queue_worker)
112+
.register(transaction_cleanup_queue_worker)
97113
.on_event(monitor_handle_event)
98114
.shutdown_timeout(Duration::from_millis(5000));
99115

0 commit comments

Comments
 (0)