try batch1 with cursor

This commit is contained in:
Joseph 2023-01-06 11:15:32 -05:00
parent 1a94db3d49
commit 28c3ae47de
No known key found for this signature in database
GPG Key ID: E709789D3076B5CC
3 changed files with 15 additions and 9 deletions

View File

@ -36,6 +36,8 @@ DECLARE
curs refcursor;
DECLARE
i RECORD;
DECLARE
curs_trans refcursor;
BEGIN
ruuid= 0;
out_reserve_found = TRUE;
@ -79,6 +81,8 @@ transaction_duplicate= TRUE;
CLOSE curs;
PERFORM pg_notify(in_notify, NULL);
OPEN curs_trans FOR
WITH reserve_transaction AS(
INSERT INTO reserves_in
(reserve_pub
,wire_reference
@ -95,16 +99,18 @@ transaction_duplicate= TRUE;
,in_exchange_account_name
,in_wire_source_h_payto
,in_expiration_date)
ON CONFLICT DO NOTHING;
ON CONFLICT DO NOTHING
RETURNING reserve_pub)
SELECT * FROM reserve_transaction;
FETCH FROM curs_trans INTO i;
IF FOUND
THEN
IF i.reserve_pub = in_reserve_pub
THEN
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
transaction_duplicate = FALSE;
ELSE
-- Unhappy...
RAISE EXCEPTION 'Reserve did not exist, but INSERT into reserves_in gave conflict';
transaction_duplicate = TRUE;
-- ROLLBACK;
END IF;
END IF;
CLOSE curs_trans;
RETURN;
END $$;

View File

@ -107,7 +107,7 @@ run (void *cls)
const char *sndr = "payto://x-taler-bank/localhost:8080/1";
struct TALER_Amount value;
unsigned int batch_size = batches[i];
unsigned int iterations = 10000;//1024*10;
unsigned int iterations = 16;//1024*10;
struct TALER_ReservePublicKeyP reserve_pubs[iterations];
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Timestamp ts;