More notification metrics fixes (#26889)
* Explicitly have the client tell the server when it should expect an ACK * Don't count missing profile errors for your own posts, added comment * Fix test * Make postedAck a parameter in WebSocketClient * Snapshot fixes --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5f1a357845
Коммит
60c15c821f
@@ -68,6 +68,7 @@ export default class WebSocketClient {
|
||||
private closeListeners = new Set<CloseListener>();
|
||||
|
||||
private connectionId: string | null;
|
||||
private postedAck: boolean;
|
||||
|
||||
constructor() {
|
||||
this.conn = null;
|
||||
@@ -77,12 +78,13 @@ export default class WebSocketClient {
|
||||
this.connectFailCount = 0;
|
||||
this.responseCallbacks = {};
|
||||
this.connectionId = '';
|
||||
this.postedAck = false;
|
||||
}
|
||||
|
||||
// on connect, only send auth cookie and blank state.
|
||||
// on hello, get the connectionID and store it.
|
||||
// on reconnect, send cookie, connectionID, sequence number.
|
||||
initialize(connectionUrl = this.connectionUrl, token?: string) {
|
||||
initialize(connectionUrl = this.connectionUrl, token?: string, postedAck?: boolean) {
|
||||
if (this.conn) {
|
||||
return;
|
||||
}
|
||||
@@ -96,10 +98,14 @@ export default class WebSocketClient {
|
||||
console.log('websocket connecting to ' + connectionUrl); //eslint-disable-line no-console
|
||||
}
|
||||
|
||||
if (typeof postedAck != 'undefined') {
|
||||
this.postedAck = postedAck;
|
||||
}
|
||||
|
||||
// Add connection id, and last_sequence_number to the query param.
|
||||
// We cannot use a cookie because it will bleed across tabs.
|
||||
// We cannot also send it as part of the auth_challenge, because the session cookie is already sent with the request.
|
||||
this.conn = new WebSocket(`${connectionUrl}?connection_id=${this.connectionId}&sequence_number=${this.serverSequence}`);
|
||||
this.conn = new WebSocket(`${connectionUrl}?connection_id=${this.connectionId}&sequence_number=${this.serverSequence}${this.postedAck ? '&posted_ack=true' : ''}`);
|
||||
this.connectionUrl = connectionUrl;
|
||||
|
||||
this.conn.onopen = () => {
|
||||
@@ -148,7 +154,7 @@ export default class WebSocketClient {
|
||||
|
||||
setTimeout(
|
||||
() => {
|
||||
this.initialize(connectionUrl, token);
|
||||
this.initialize(connectionUrl, token, postedAck);
|
||||
},
|
||||
retryTime,
|
||||
);
|
||||
|
||||
Ссылка в новой задаче
Block a user