eonx-com / webhooks

The EoneoPay Webhook
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

PYMT-687: Retry failed webhooks #24

Closed rashmitsingh closed 5 years ago

rashmitsingh commented 5 years ago

Ticket here

This creates a service which calls the repository on webhook requests to get list of requests since date provided which have not yet succeeded. This then add the request to event dispatcher.

I had to write code to spin off Doctrine Entity Manager in this to be able to test the repository method.

The query to get list of failed requests is as below with EXPLAIN.

The explain is from database which had 60k webhook responses and 20k webhook requests.

SELECT q.id FROMevent_activity_requestsq WHERE q.id NOT IN(SELECT DISTINCT(s.request_id) FROMevent_activity_responsess WHERE s.status_code = 200) AND q.created_at >= '2019-06-10 00:00:00';

id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY q NULL range idx_created_at_webhook_request idx_created_at_webhook_request 5 NULL 6579 100 Using where; Using index
2 SUBQUERY s NULL ref IDX_EC6770B7427EB8A5,idx_status_code_webhook_response idx_status_code_webhook_response 5 const 3493 100 NULL