-address FIXMEs

This commit is contained in:
Christian Grothoff 2023-01-22 15:24:45 +01:00
parent f8bfc4dc9d
commit f221db1c03
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 20 additions and 4 deletions

View File

@ -30,6 +30,12 @@
#include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_responses.h"
/**
* How often do we try the DB operation at most?
*/
#define MAX_RETRIES 10
MHD_RESULT MHD_RESULT
TEH_handler_post_aml_decision ( TEH_handler_post_aml_decision (
struct TEH_RequestContext *rc, struct TEH_RequestContext *rc,
@ -80,7 +86,7 @@ TEH_handler_post_aml_decision (
&new_threshold, &new_threshold,
&h_payto, &h_payto,
new_state, new_state,
&officer_pub, officer_pub,
&officer_sig)) &officer_sig))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -94,19 +100,21 @@ TEH_handler_post_aml_decision (
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Timestamp last_date; struct GNUNET_TIME_Timestamp last_date;
bool invalid_officer; bool invalid_officer;
unsigned int retries_left = MAX_RETRIES;
do { do {
// FIXME: bound loop?
qs = TEH_plugin->insert_aml_decision (TEH_plugin->cls, qs = TEH_plugin->insert_aml_decision (TEH_plugin->cls,
&h_payto, &h_payto,
&new_threshold, &new_threshold,
new_state, new_state,
decision_time, decision_time,
justification, justification,
&officer_pub, officer_pub,
&officer_sig, &officer_sig,
&invalid_officer, &invalid_officer,
&last_date); &last_date);
if (0 == --retries_left)
break;
} while (GNUNET_DB_STATUS_SOFT_ERROR == qs); } while (GNUNET_DB_STATUS_SOFT_ERROR == qs);
if (qs < 0) if (qs < 0)
{ {

View File

@ -31,6 +31,12 @@
#include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_responses.h"
/**
* How often do we try the DB operation at most?
*/
#define MAX_RETRIES 10
MHD_RESULT MHD_RESULT
TEH_handler_management_aml_officers ( TEH_handler_management_aml_officers (
struct MHD_Connection *connection, struct MHD_Connection *connection,
@ -90,9 +96,9 @@ TEH_handler_management_aml_officers (
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Timestamp last_date; struct GNUNET_TIME_Timestamp last_date;
unsigned int retries_left = MAX_RETRIES;
do { do {
// FIXME: bound loop!
qs = TEH_plugin->insert_aml_officer (TEH_plugin->cls, qs = TEH_plugin->insert_aml_officer (TEH_plugin->cls,
&officer_pub, &officer_pub,
&master_sig, &master_sig,
@ -101,6 +107,8 @@ TEH_handler_management_aml_officers (
read_only, read_only,
change_date, change_date,
&last_date); &last_date);
if (0 == --retries_left)
break;
} while (GNUNET_DB_STATUS_SOFT_ERROR == qs); } while (GNUNET_DB_STATUS_SOFT_ERROR == qs);
if (qs < 0) if (qs < 0)
{ {