rcmaples / shftr

0 stars 0 forks source link

Improperly attempting to assign tickets to non-supeng and failing #4

Closed rcmaples closed 2 years ago

rcmaples commented 3 years ago

ZD Ticket 138383 came in to the Mobile queue over night and went into the offline queue as expected. Later that morning when Kelsey came online, shftr attempted to assign the ticket to her and failed. Here is the relevant logging:

2021-09-27T08:15:00.675562+00:00 app[web.1]: Mon Sep 27 2021 08:15:00 GMT+0000 (Coordinated Universal Time) - There are 1 tickets in the offline queue.
2021-09-27T08:15:00.754934+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'zendeskId' of 'winningAgent' as it is undefined.
2021-09-27T08:15:00.754936+00:00 app[web.1]: at assignTicket (/app/utils/ticketAssignment.js:75:9)
2021-09-27T08:15:00.754937+00:00 app[web.1]: at runMicrotasks (<anonymous>)
2021-09-27T08:15:00.754938+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-09-27T08:15:00.754939+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-09-27T08:15:00.755072+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-09-27T08:15:00.755129+00:00 app[web.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Later, Kelsey escalated ZD Ticket 138285 and shftr again tried to assign it to her instead of putting it in the offline queue.

Relevant logs:

2021-09-27T08:33:17.939563+00:00 app[web.1]: POST /api/zendesk-ticket 200 39.578 ms - 153
2021-09-27T08:33:17.939815+00:00 heroku[router]: at=info method=POST path="/api/zendesk-ticket" host=shftr.fyi request_id=0ac6b823-d30d-4a18-b475-7e91138732af fwd="216.198.1.182" dyno=web.1 connect=0ms service=41ms status=200 bytes=361 protocol=https
2021-09-27T08:33:18.018534+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'zendeskId' of 'winningAgent' as it is undefined.
2021-09-27T08:33:18.018536+00:00 app[web.1]: at assignTicket (/app/utils/ticketAssignment.js:75:9)
2021-09-27T08:33:18.018537+00:00 app[web.1]: at runMicrotasks (<anonymous>)
2021-09-27T08:33:18.018537+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-09-27T08:33:18.018662+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

The failure technically comes from here: https://github.com/rcmaples/shftr/blob/d9da3f5bafdd3378f1c55702180bd2b0c8fc9d6a/utils/ticketAssignment.js#L68-L75

But the real problem is the way infiniteImprobabilityDrive() is returning online agents. I wonder if we can change the logic here to look for online and supeng... https://github.com/rcmaples/shftr/blob/d9da3f5bafdd3378f1c55702180bd2b0c8fc9d6a/utils/ticketAssignment.js#L31

rcmaples commented 2 years ago

resolved by https://github.com/rcmaples/shftr/pull/5