Skip to content

Conversation

@murtaza98
Copy link
Contributor

@murtaza98 murtaza98 commented Jan 6, 2022

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

  1. Navigate to Administration > Omnichannel > Business Hours, set the Business Hour Type to Multiple and Save changes. Make sure that the default business hour is active.
  2. Create a new user from the admin section with livechat-agent role.
  3. Login to the server as the agent, change the Omnichannel status from Available to Not Available and try changing it back to Available.

Expected Behavior:
The agent should be able to change it back to Available as long as the business hour for the default department is active.

Actual Behavior:
Even with the business hours still open, the agent is unable to change Omnichannel status back to Available as they keep getting the error message "Business hours are closed". The error in the server log is:

server.js:204 System ➔ error Exception while invoking method livechat:changeLivechatStatus Not allowed [error-business-hours-are-closed]

Further comments

Sidenote from Tech point of view: There were a lot of scenarios where the business hour might throw false negatives - the one I mentioned above. This is a result of a stale business hour cache that we maintain on the user's DB collection. My first thought was to handle all the edge cases which were causing this stale cache issue, but after a few minutes, I realised there can be a lot of these cases, so instead of complicating the implementation by handling each of the above cases, I went with a different approach.

What I do now instead is, if no active business hour is found within the user's cache, then we recheck if any business hour is active at the time being for this agent.

  • If one is found then we update the user's cache with it, so the cache gets updated.
  • If none is found, then we throw the error like we used to do before.

I do understand with this new implementation, there would be more processing required for true negatives, but I think that's a fair tradeoff to avoid false negatives like this since those are affecting the end-users

@murtaza98 murtaza98 requested a review from a team January 6, 2022 13:41
@murtaza98 murtaza98 merged commit 1a5d288 into develop Jan 20, 2022
@murtaza98 murtaza98 deleted the omni/fix-business-hour-status branch January 20, 2022 07:11
@sampaiodiego sampaiodiego mentioned this pull request Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants