mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 17:45:10 +00:00
Clear Transaction when no contract found
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
This commit is contained in:
parent
bf91df7ef3
commit
9aec7ffd2a
2 changed files with 13 additions and 0 deletions
|
|
@ -280,6 +280,18 @@ describe('Fabric', () => {
|
||||||
const index = await redis.zrange('index:txn:timestamp', 0, -1);
|
const index = await redis.zrange('index:txn:timestamp', 0, -1);
|
||||||
expect(index).toStrictEqual([]);
|
expect(index).toStrictEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('starts a retry loop which clears the saved details when no contract exist for the org', async () => {
|
||||||
|
addMockTransationDetails(redis);
|
||||||
|
mockContracts = new Map<string, Contract>();
|
||||||
|
startRetryLoop(mockContracts, redis);
|
||||||
|
jest.runOnlyPendingTimers();
|
||||||
|
await flushPromises();
|
||||||
|
|
||||||
|
const index = await redis.zrange('index:txn:timestamp', 0, -1);
|
||||||
|
expect(index).toStrictEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('evatuateTransaction', () => {
|
describe('evatuateTransaction', () => {
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,7 @@ export const startRetryLoop = (
|
||||||
if (contract) {
|
if (contract) {
|
||||||
await retryTransaction(contract, redis, savedTransaction);
|
await retryTransaction(contract, redis, savedTransaction);
|
||||||
} else {
|
} else {
|
||||||
|
clearTransactionDetails(redis,savedTransaction.transactionId)
|
||||||
logger.error(
|
logger.error(
|
||||||
'No contract found for %s to retry transaction %s',
|
'No contract found for %s to retry transaction %s',
|
||||||
savedTransaction.mspId,
|
savedTransaction.mspId,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue