You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Keep a push processor and re-use it. (#622)
Because it does some nice caching stuff but that's no good if we re-create a new one each time.
This commit is contained in:
committed by
Luke Barnard
parent
e258d6ca8d
commit
5f12d858eb
@@ -187,6 +187,9 @@ function MatrixClient(opts) {
|
|||||||
// we still want to know which rooms are encrypted even if crypto is disabled:
|
// we still want to know which rooms are encrypted even if crypto is disabled:
|
||||||
// we don't want to start sending unencrypted events to them.
|
// we don't want to start sending unencrypted events to them.
|
||||||
this._roomList = new RoomList(this._cryptoStore, this._sessionStore);
|
this._roomList = new RoomList(this._cryptoStore, this._sessionStore);
|
||||||
|
|
||||||
|
// The pushprocessor caches useful things, so keep one and re-use it
|
||||||
|
this._pushProcessor = new PushProcessor(this);
|
||||||
}
|
}
|
||||||
utils.inherits(MatrixClient, EventEmitter);
|
utils.inherits(MatrixClient, EventEmitter);
|
||||||
utils.extend(MatrixClient.prototype, MatrixBaseApis.prototype);
|
utils.extend(MatrixClient.prototype, MatrixBaseApis.prototype);
|
||||||
@@ -1748,8 +1751,7 @@ function _membershipChange(client, roomId, userId, membership, reason, callback)
|
|||||||
*/
|
*/
|
||||||
MatrixClient.prototype.getPushActionsForEvent = function(event) {
|
MatrixClient.prototype.getPushActionsForEvent = function(event) {
|
||||||
if (!event.getPushActions()) {
|
if (!event.getPushActions()) {
|
||||||
const pushProcessor = new PushProcessor(this);
|
event.setPushActions(this._pushProcessor.actionsForEvent(event));
|
||||||
event.setPushActions(pushProcessor.actionsForEvent(event));
|
|
||||||
}
|
}
|
||||||
return event.getPushActions();
|
return event.getPushActions();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user