try batch1 with cursor
This commit is contained in:
parent
1a94db3d49
commit
28c3ae47de
@ -36,6 +36,8 @@ DECLARE
|
|||||||
curs refcursor;
|
curs refcursor;
|
||||||
DECLARE
|
DECLARE
|
||||||
i RECORD;
|
i RECORD;
|
||||||
|
DECLARE
|
||||||
|
curs_trans refcursor;
|
||||||
BEGIN
|
BEGIN
|
||||||
ruuid= 0;
|
ruuid= 0;
|
||||||
out_reserve_found = TRUE;
|
out_reserve_found = TRUE;
|
||||||
@ -79,6 +81,8 @@ transaction_duplicate= TRUE;
|
|||||||
CLOSE curs;
|
CLOSE curs;
|
||||||
|
|
||||||
PERFORM pg_notify(in_notify, NULL);
|
PERFORM pg_notify(in_notify, NULL);
|
||||||
|
OPEN curs_trans FOR
|
||||||
|
WITH reserve_transaction AS(
|
||||||
INSERT INTO reserves_in
|
INSERT INTO reserves_in
|
||||||
(reserve_pub
|
(reserve_pub
|
||||||
,wire_reference
|
,wire_reference
|
||||||
@ -95,16 +99,18 @@ transaction_duplicate= TRUE;
|
|||||||
,in_exchange_account_name
|
,in_exchange_account_name
|
||||||
,in_wire_source_h_payto
|
,in_wire_source_h_payto
|
||||||
,in_expiration_date)
|
,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
|
IF FOUND
|
||||||
|
THEN
|
||||||
|
IF i.reserve_pub = in_reserve_pub
|
||||||
THEN
|
THEN
|
||||||
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
|
-- HAPPY PATH THERE IS NO DUPLICATE TRANS
|
||||||
transaction_duplicate = FALSE;
|
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;
|
||||||
|
END IF;
|
||||||
|
CLOSE curs_trans;
|
||||||
RETURN;
|
RETURN;
|
||||||
END $$;
|
END $$;
|
||||||
|
@ -107,7 +107,7 @@ run (void *cls)
|
|||||||
const char *sndr = "payto://x-taler-bank/localhost:8080/1";
|
const char *sndr = "payto://x-taler-bank/localhost:8080/1";
|
||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
unsigned int batch_size = batches[i];
|
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 TALER_ReservePublicKeyP reserve_pubs[iterations];
|
||||||
struct GNUNET_TIME_Absolute now;
|
struct GNUNET_TIME_Absolute now;
|
||||||
struct GNUNET_TIME_Timestamp ts;
|
struct GNUNET_TIME_Timestamp ts;
|
||||||
|
Loading…
Reference in New Issue
Block a user