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
Description
Need to rework processPaidWebhooks cron job.
Desired behaviour:
In case await escrowClient.complete() is successful we don't need to try complete the escrow again.
In case webhookService.sendWebhook() fails, we want to launch a cron job only for resending failed webhook(s).
My suggestion here is to implement some kind of a webhook queue because we are sending webhooks to multiple instances (JL, ExO, RecO) and we want to track which notification failed to be sent.
Motivation
With current implementation in case escrow has been successfully completed but webhook wasn't sent, cron job will be launched again trying to update escrow status to completed and this operation will fail causing webhook to be stuck.
Implementation details
Here’s a refined version of the implementation details with improved structure and clarity:
Implementation Details:
Update WebhookIncomingEntity model:
Rename WebhookIncomingEntity to WebhookEntity.
Add an enum field type to WebhookEntity with values: in and out.
Add a failedReason field to store the reason for failed webhooks.
Add a url field to store the webhook url.
Cron Module to track in webhooks:
Monitor WebhookEntity entries with type: in and status pending.
For each webhook, check the current escrow status:
If escrow is incomplete, invoke escrowClient.complete().
If escrow fails, increment retriesCount and retry the operation.
Create webhooks:
Generate three WebhookEntity instances with type: out and status pending.
Update in webhook status:
Update the status of the WebhookEntity with type: in to completed.
Cron module to track out webhooks:
Monitor WebhookEntity entries with type: out and status pending.
For each out webhook:
Use webhookService.sendWebhook() to send the notification.
If sending fails, increment retriesCount and store the failedReason.
Upon successful delivery, update the related in webhook status to completed.
Update migrations
Update unit tests
The text was updated successfully, but these errors were encountered:
Description
Need to rework
processPaidWebhooks
cron job.Desired behaviour:
In case
await escrowClient.complete()
is successful we don't need to try complete the escrow again.In case
webhookService.sendWebhook()
fails, we want to launch a cron job only for resending failed webhook(s).My suggestion here is to implement some kind of a webhook queue because we are sending webhooks to multiple instances (JL, ExO, RecO) and we want to track which notification failed to be sent.
Motivation
With current implementation in case escrow has been successfully completed but webhook wasn't sent, cron job will be launched again trying to update escrow status to
completed
and this operation will fail causing webhook to be stuck.Implementation details
Here’s a refined version of the implementation details with improved structure and clarity:
Implementation Details:
Update
WebhookIncomingEntity
model:WebhookIncomingEntity
toWebhookEntity
.type
toWebhookEntity
with values:in
andout
.failedReason
field to store the reason for failed webhooks.url
field to store the webhook url.Cron Module to track
in
webhooks:WebhookEntity
entries withtype: in
and statuspending
.escrowClient.complete()
.retriesCount
and retry the operation.Create webhooks:
WebhookEntity
instances withtype: out
and statuspending
.Update
in
webhook status:WebhookEntity
withtype: in
tocompleted
.Cron module to track
out
webhooks:WebhookEntity
entries withtype: out
and statuspending
.out
webhook:webhookService.sendWebhook()
to send the notification.retriesCount
and store thefailedReason
.in
webhook status tocompleted
.Update migrations
Update unit tests
The text was updated successfully, but these errors were encountered: