Skip to content

Commit

Permalink
[lib] send confirmation for ignored DM ops
Browse files Browse the repository at this point in the history
Summary:
[ENG-9456](https://linear.app/comm/issue/ENG-9456/send-confirmation-for-ignored-dm-ops).

Avoiding keeping this operation forever when it's invalid.

Depends on D13662

Test Plan: Created DM Op which will be ignored and make sure it is confirmed.

Reviewers: tomek

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D13663
  • Loading branch information
xsanm committed Oct 14, 2024
1 parent 0ea97c4 commit eed6217
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/shared/dm-ops/process-dm-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
usePeerToPeerCommunication,
type ProcessOutboundP2PMessagesResult,
} from '../../tunnelbroker/peer-to-peer-context.js';
import { useConfirmPeerToPeerMessage } from '../../tunnelbroker/use-confirm-peer-to-peer-message.js';
import {
processDMOpsActionType,
queueDMOpsActionType,
Expand All @@ -39,6 +40,7 @@ function useProcessDMOperation(): (
const dispatchWithMetadata = useDispatchWithMetadata();
const processBlobHolders = useProcessBlobHolders();
const createMessagesToPeersFromDMOp = useCreateMessagesToPeersFromDMOp();
const confirmPeerToPeerMessage = useConfirmPeerToPeerMessage();

const dispatch = useDispatch();

Expand Down Expand Up @@ -121,6 +123,7 @@ function useProcessDMOperation(): (

if (!dmOpSpecs[dmOp.type].operationValidator.is(dmOp)) {
console.log(`Ignoring ${dmOp.type} operation because it is invalid`);
await confirmPeerToPeerMessage(dispatchMetadata);
return;
}

Expand All @@ -131,6 +134,7 @@ function useProcessDMOperation(): (

if (!processingCheckResult.isProcessingPossible) {
if (processingCheckResult.reason.type === 'invalid') {
await confirmPeerToPeerMessage(dispatchMetadata);
return;
}
let condition;
Expand Down Expand Up @@ -167,6 +171,7 @@ function useProcessDMOperation(): (
},
dispatchMetadata,
);
await confirmPeerToPeerMessage(dispatchMetadata);
return;
}

Expand Down Expand Up @@ -236,6 +241,7 @@ function useProcessDMOperation(): (
dispatchWithMetadata,
createMessagesToPeersFromDMOp,
dispatch,
confirmPeerToPeerMessage,
],
);
}
Expand Down

0 comments on commit eed6217

Please sign in to comment.