Skip to content

Commit 794efb1

Browse files
0xaslanclaude
andauthored
fix(margin): use write DB connection for margin poller (#893)
The margin poller inserts into margin_pool_snapshots every 30 seconds but was using Db::for_read, which sets read-only transaction mode. This caused "cannot execute INSERT in a read-only transaction" errors across all server pods. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5f825df commit 794efb1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/server/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub async fn run_server(
287287
if let Some(margin_pkg_id) = margin_package_id {
288288
let cancellation_token = tokio_util::sync::CancellationToken::new();
289289
let margin_metrics = crate::margin_metrics::MarginMetrics::new(metrics.registry());
290-
let margin_db = sui_pg_db::Db::for_read(database_url, db_arg).await?;
290+
let margin_db = sui_pg_db::Db::for_write(database_url, db_arg).await?;
291291
let margin_poller = crate::margin_metrics::MarginPoller::new(
292292
margin_db,
293293
rpc_url.clone(),

0 commit comments

Comments
 (0)