Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Updating path responseBy would create a conflict on responseBy #33412

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

KevLehman
Copy link
Contributor

Proposed changes (including videos or screenshots)

  • Removes unnecessary call to getAgentLastMessageTsUpdateQuery
  • Changes the logic for applying the update on the responseBy object in a way that won't create a conflict.

Issue(s)

https://rocketchat.atlassian.net/browse/CORE-703

Steps to test or reproduce

  • Kinda hard to reproduce. It just happened in candidate with a single whatsapp conversation after having 2 agents + visitor interacting on the same conversation.
  • On local, you can force it to happen by sending a message on a conversation, then manually updating the database to set waitingResponse: true flag on the room object and send a message again. It should fail.

When these preconditions are met, Mongo will get an update similar to:

{
  $set: {
		'responseBy.lastMessageTs': ISODate(),
   		 responseBy: { lastMessageTs: ISODate() }
  },
}

Since the same update is modifying the same property on different ways, Mongo issues a "ConflictError" and blocks the update.

Further comments

Copy link
Contributor

dionisio-bot bot commented Oct 1, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Oct 1, 2024

🦋 Changeset detected

Latest commit: 6844fa3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/models Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@KevLehman KevLehman added this to the 6.14 milestone Oct 1, 2024
Copy link
Contributor

github-actions bot commented Oct 1, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-33412/
on branch gh-pages at 2024-10-15 15:35 UTC

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.43%. Comparing base (72c6101) to head (6844fa3).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #33412      +/-   ##
===========================================
+ Coverage    58.41%   58.43%   +0.02%     
===========================================
  Files         2744     2745       +1     
  Lines        66247    66337      +90     
  Branches     14988    15007      +19     
===========================================
+ Hits         38697    38764      +67     
- Misses       24730    24749      +19     
- Partials      2820     2824       +4     
Flag Coverage Δ
unit 74.62% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@KevLehman KevLehman marked this pull request as ready for review October 1, 2024 19:41
@KevLehman KevLehman requested a review from a team as a code owner October 1, 2024 19:41
Copy link
Contributor

@aleksandernsilva aleksandernsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omnichannel

Copy link
Contributor

@aleksandernsilva aleksandernsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KevLehman If possible, adding a unit test that verifies this scenario might be a good idea.

@KevLehman KevLehman requested a review from a team as a code owner October 2, 2024 15:30
@jessicaschelly jessicaschelly added the stat: QA assured Means it has been tested and approved by a company insider label Oct 15, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 15, 2024
@kodiakhq kodiakhq bot merged commit 065a742 into develop Oct 15, 2024
50 checks passed
@kodiakhq kodiakhq bot deleted the fix/waiting-response-response-by-conflict branch October 15, 2024 17:16
@ggazzo ggazzo modified the milestones: 6.14, 7.0 Oct 17, 2024
This was referenced Oct 20, 2024
@cuonghuunguyen
Copy link
Contributor

We need this for v6, could you create a backport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants