Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIX] im_livechat: instantly receive messages from new livechat
Before this commit, when new messages were posted in a new
livechat, the operator received them after a delay. This
may take up to a minute before receiving the notification.

This behaviour was causing a bigger issue: those notifications
may never be received by the operator. This case happened when
the operator was receiving more recent notifications while
notifications from new livechats were pending.

The delay was caused by the operator not yet subscribed to
notifications on the newly created livechat. It is only on
the next poll of longpolling that the subscription occurred,
then followed by dispatching the notifications to the operator.

This commit fixes the issue by dispatching new messages of new
livechats directly to the operator. This is done by enforcing
the operator to make another polling when a new livechat is created,
so that he is always subscribed to those livechats. As a result,
new messages are received instantaneously.

opw-1933951
  • Loading branch information
alexkuhn committed Feb 18, 2019
1 parent f53ad8a commit 2df4e34
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions addons/im_livechat/models/im_livechat_channel.py
Expand Up @@ -177,6 +177,7 @@ def get_mail_channel(self, livechat_channel_id, anonymous_name):
'public': 'private',
'email_send': False,
})
mail_channel._broadcast([operator_partner_id])
return mail_channel.sudo().with_context(im_livechat_operator_partner_id=operator_partner_id).channel_info()[0]

@api.model
Expand Down

0 comments on commit 2df4e34

Please sign in to comment.