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: Omnichannel queue starting multiple times due to race condition #34062

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Nov 26, 2024

Proposed changes (including videos or screenshots)

This PR fixes a bug causing the Omnichannel queue to start more than once due to a race condition. In order to prevent the race condition settings.watch was changed to settings.watchMultiple which has a debounce built in.

Bug caught through this test omnichannel-livechat-queue-management-autoselection.spec.ts

Introduced here: #33719

Issue(s)

Steps to test or reproduce

Further comments

CONN-429

Copy link
Contributor

dionisio-bot bot commented Nov 26, 2024

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is targeting the wrong base branch. It should target 7.2.0, but it targets 7.1.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Nov 26, 2024

🦋 Changeset detected

Latest commit: 8f0c01c

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

This PR includes changesets to release 35 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-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip 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

@aleksandernsilva aleksandernsilva changed the title fix: Omnichannel queue being started multiple times due to race condition fix: Omnichannel queue starting multiple times due to race condition Nov 26, 2024
Copy link
Contributor

github-actions bot commented Nov 26, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-34062/
on branch gh-pages at 2024-11-29 21:36 UTC

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.

Project coverage is 75.79%. Comparing base (e49c987) to head (8f0c01c).
Report is 27 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #34062      +/-   ##
===========================================
- Coverage    75.79%   75.79%   -0.01%     
===========================================
  Files          510      511       +1     
  Lines        22063    22130      +67     
  Branches      5385     5394       +9     
===========================================
+ Hits         16723    16773      +50     
- Misses        4694     4709      +15     
- Partials       646      648       +2     
Flag Coverage Δ
unit 75.79% <90.74%> (-0.01%) ⬇️

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

@aleksandernsilva aleksandernsilva marked this pull request as ready for review November 26, 2024 20:14
@aleksandernsilva aleksandernsilva requested a review from a team as a code owner November 26, 2024 20:14
@aleksandernsilva aleksandernsilva added this to the 7.2.0 milestone Nov 26, 2024
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc left a comment

Choose a reason for hiding this comment

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

It will still be called multiple times as shouldStart is also called when the license is validated.

@aleksandernsilva aleksandernsilva marked this pull request as draft December 2, 2024 14:24
@aleksandernsilva aleksandernsilva marked this pull request as ready for review December 2, 2024 19:31
}

async stop() {
await this.serviceStarter.stop();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await this.serviceStarter.stop();
return this.serviceStarter.stop();

@@ -34,20 +46,34 @@ export class OmnichannelQueue implements IOmnichannelQueue {
this.running = true;

queueLogger.info('Service started');
return this.execute();
await this.execute();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await this.execute();
return this.execute();

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.

2 participants