add post HTTP request check for hanging transactions

This commit is contained in:
Christian Grothoff 2019-04-18 14:38:24 +02:00
parent 5d3ae9655e
commit 32a3a0ffb0
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 67 additions and 63 deletions

View File

@ -146,6 +146,12 @@ handle_mhd_completion_callback (void *cls,
return; return;
TEH_PARSE_post_cleanup_callback (*con_cls); TEH_PARSE_post_cleanup_callback (*con_cls);
*con_cls = NULL; *con_cls = NULL;
/* check that we didn't leave any transactions hanging */
/* NOTE: In high-performance production, we might want to
remove this. */
TEH_plugin->preflight (TEH_plugin->cls,
TEH_plugin->get_session (TEH_plugin->cls));
} }

View File

@ -1075,11 +1075,9 @@ postgres_prepare (PGconn *db_conn)
",h_contract_terms" ",h_contract_terms"
",h_wire" ",h_wire"
" FROM deposits" " FROM deposits"
" WHERE (" " WHERE ((coin_pub=$1)"
" (coin_pub=$1)"
" AND (merchant_pub=$3)" " AND (merchant_pub=$3)"
" AND (h_contract_terms=$2)" " AND (h_contract_terms=$2))"
" )"
" FOR UPDATE;", " FOR UPDATE;",
3), 3),
/* Fetch deposits with rowid '\geq' the given parameter */ /* Fetch deposits with rowid '\geq' the given parameter */