mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Implement unsubscription in the Aphlict client.
Summary: Ref T5284. When an `AphlictClient` is closed, it will eventually be purged from the pool by the `AphlictMaster`. When this happens, also unsubscribe the purged client from all notifications, and send an `unsubscribe` command to the Aphlict server if possible. Test Plan: Verified the output of the Aphlict server (running in debug mode): ``` [Wed Jun 11 2014 23:21:31 GMT+0000 (UTC)] <FlashPolicy> Policy Request From ::ffff:192.168.1.1 [Wed Jun 11 2014 23:21:31 GMT+0000 (UTC)] <Listener/2> Connected from ::ffff:192.168.1.1 [Wed Jun 11 2014 23:21:31 GMT+0000 (UTC)] <Listener/2> Received data: {"command":"subscribe","data":["PHID-USER-cb5af6p4oepy5tlgqypi"]} [Wed Jun 11 2014 23:21:31 GMT+0000 (UTC)] <Listener/2> Subscribed to: ["PHID-USER-cb5af6p4oepy5tlgqypi"] [Wed Jun 11 2014 23:21:39 GMT+0000 (UTC)] <Listener/2> Received data: {"command":"subscribe","data":["PHID-TASK-l2dtbs5xrt2b7abgh5a6"]} [Wed Jun 11 2014 23:21:39 GMT+0000 (UTC)] <Listener/2> Subscribed to: ["PHID-TASK-l2dtbs5xrt2b7abgh5a6"] [Wed Jun 11 2014 23:21:57 GMT+0000 (UTC)] <Listener/2> Received data: {"command":"unsubscribe","data":["PHID-TASK-l2dtbs5xrt2b7abgh5a6"]} [Wed Jun 11 2014 23:21:57 GMT+0000 (UTC)] <Listener/2> Unsubscribed from: ["PHID-TASK-l2dtbs5xrt2b7abgh5a6"] ``` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5284 Differential Revision: https://secure.phabricator.com/D9492
This commit is contained in:
parent
299510737d
commit
cbd95b91b5
3 changed files with 24 additions and 2 deletions
|
@ -477,7 +477,7 @@ return array(
|
||||||
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
|
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
|
||||||
'rsrc/js/phuix/PHUIXActionView.js' => '6e8cefa4',
|
'rsrc/js/phuix/PHUIXActionView.js' => '6e8cefa4',
|
||||||
'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca',
|
'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca',
|
||||||
'rsrc/swf/aphlict.swf' => '2dea6ddc',
|
'rsrc/swf/aphlict.swf' => '14d5aa2e',
|
||||||
),
|
),
|
||||||
'symbols' =>
|
'symbols' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -88,6 +88,9 @@ package {
|
||||||
if (new Date().getTime() - checkin > AphlictMaster.PURGE_INTERVAL) {
|
if (new Date().getTime() - checkin > AphlictMaster.PURGE_INTERVAL) {
|
||||||
this.log('Purging client: ' + client);
|
this.log('Purging client: ' + client);
|
||||||
delete this.clients[client];
|
delete this.clients[client];
|
||||||
|
|
||||||
|
this.log('Removing client subscriptions: ' + client);
|
||||||
|
this.unsubscribeAll(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,10 +166,29 @@ package {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getSubscriptions(client:String):Array {
|
||||||
|
var subscriptions = new Array();
|
||||||
|
|
||||||
|
for (var phid:String in this.subscriptions) {
|
||||||
|
var clients = this.subscriptions[phid];
|
||||||
|
if (clients[client]) {
|
||||||
|
subscriptions.push(phid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return subscriptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function unsubscribeAll(client:String):void {
|
||||||
|
this.unsubscribe(client, this.getSubscriptions(client));
|
||||||
|
}
|
||||||
|
|
||||||
public function unsubscribe(client:String, phids:Array):void {
|
public function unsubscribe(client:String, phids:Array):void {
|
||||||
var oldPHIDs = new Array();
|
var oldPHIDs = new Array();
|
||||||
|
|
||||||
for (var phid:String in phids) {
|
for (var i:String in phids) {
|
||||||
|
var phid = phids[i];
|
||||||
|
|
||||||
if (!this.subscriptions[phid]) {
|
if (!this.subscriptions[phid]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue