WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: simplify deletion logic using SQS built-in retry
Removed manual state tracking and DLQ handling in favor of SQS's built-in
retry mechanism. Both mParticle and Braze APIs are idempotent (404 = success),
so we can safely retry without tracking which services have succeeded.
* 4. If either fails with retryable error: throws to trigger SQS retry
15
+
* 5. SQS automatically retries up to maxReceiveCount, then moves to DLQ
23
16
*
24
-
* @param body - The deletion request containing userId
25
-
* @param attributes - Message attributes tracking deletion status
17
+
* @param userId - The user ID to delete
26
18
* @param mParticleClient - Client for mParticle API
27
19
* @param brazeClient - Client for Braze API
28
-
* @param dlqUrl - URL of the dead letter queue for failed deletions
29
-
* @returns DeletionStatus indicating which APIs succeeded
30
20
*/
31
21
exportasyncfunctionprocessUserDeletion(
32
-
body: DeletionRequestBody,
33
-
attributes: MessageAttributes,
22
+
userId: string,
34
23
mParticleClient: MParticleClient,
35
24
brazeClient: BrazeClient,
36
-
dlqUrl: string,
37
-
): Promise<DeletionStatus>{
38
-
const{ userId }=body;
39
-
constattemptCount=attributes.attemptCount+1;
25
+
): Promise<void>{
26
+
logger.log(`Processing deletion for user ${userId}`);
40
27
41
-
logger.log(
42
-
`Processing deletion for user ${userId}, attempt ${attemptCount}. Current status: mParticle=${attributes.mParticleDeleted}, Braze=${attributes.brazeDeleted}`,
43
-
);
28
+
// Call both APIs - they're idempotent (404 = success)
0 commit comments