mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-25 00:36:42 -06:00
fix(client): ストリーミングのメモリリークを修正
SharedConnection や NonSharedConnection のインスタンスを Vue コンポーネントの data に含むと、Vue が Proxy に変換するため、Stream クラス内部でインスタンス同士の比較をしても false になり、使われなくなったインスタンスがメモリ上に残り続ける。 なお、チャンネルへの接続/切断は頻繁に行うものではないため、メモリリークといっても影響は軽微とみられる。
This commit is contained in:
parent
75a9ff832a
commit
c055b4d32d
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import { EventEmitter } from 'eventemitter3';
|
import { EventEmitter } from 'eventemitter3';
|
||||||
import ReconnectingWebsocket from 'reconnecting-websocket';
|
import ReconnectingWebsocket from 'reconnecting-websocket';
|
||||||
|
import { markRaw } from 'vue';
|
||||||
import { debug, wsUrl } from '@/config';
|
import { debug, wsUrl } from '@/config';
|
||||||
import { query as urlQuery } from '../../prelude/url';
|
import { query as urlQuery } from '../../prelude/url';
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default class Stream extends EventEmitter {
|
||||||
this.sharedConnectionPools.push(pool);
|
this.sharedConnectionPools.push(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
const connection = new SharedConnection(this, channel, pool, name);
|
const connection = markRaw(new SharedConnection(this, channel, pool, name));
|
||||||
this.sharedConnections.push(connection);
|
this.sharedConnections.push(connection);
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +54,7 @@ export default class Stream extends EventEmitter {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public connectToChannel(channel: string, params?: any): NonSharedConnection {
|
public connectToChannel(channel: string, params?: any): NonSharedConnection {
|
||||||
const connection = new NonSharedConnection(this, channel, params);
|
const connection = markRaw(new NonSharedConnection(this, channel, params));
|
||||||
this.nonSharedConnections.push(connection);
|
this.nonSharedConnections.push(connection);
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue