HomePhabricator

Multiplex AJAX calls

Description

Multiplex AJAX calls

Summary: Fixes T5344. Essentially, we only make the AJAX request to /notification/individual/ if we are the leader tab (i.e. only one tab will make this request). Once a response has been received from the server (containing the contents of the notification), we broadcast the message contents back to all other tabs for rendering.

Test Plan:
Opened two tabs on /notification/status/ and clicked "Send Test Notification".

Before

tail -f /var/log/phabricator-access.log | grep /notification/individual/
[Tue, 13 Jan 2015 20:10:37 +1100]   17033   phabricator 10.0.0.1    josh    PhabricatorNotificationIndividualController -   /notification/individual/-200   236036
[Tue, 13 Jan 2015 20:10:37 +1100]   17657   phabricator 10.0.0.1    josh    PhabricatorNotificationIndividualController -   /notification/individual/-200   24130

After

tail -f /var/log/phabricator-access.log | grep /notification/individual/
[Tue, 13 Jan 2015 20:11:15 +1100]   17657   phabricator 10.0.0.1    josh    PhabricatorNotificationIndividualController -   /notification/individual/-200   180217

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5344

Differential Revision: https://secure.phabricator.com/D11360

Details