chore: remove stack from WaitForEventInfo (#6259)

This commit is contained in:
Yury Semikhatsky 2021-04-22 10:05:37 -07:00 committed by GitHub
parent fe4fba4a16
commit 3a93c419f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 14 deletions

View File

@ -16,12 +16,11 @@
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import * as channels from '../protocol/channels'; import * as channels from '../protocol/channels';
import type { Connection } from './connection'; import { createScheme, ValidationError, Validator } from '../protocol/validator';
import type { Logger } from './types';
import { debugLogger } from '../utils/debugLogger'; import { debugLogger } from '../utils/debugLogger';
import { rewriteErrorMessage } from '../utils/stackTrace'; import { rewriteErrorMessage } from '../utils/stackTrace';
import { createScheme, Validator, ValidationError } from '../protocol/validator'; import type { Connection } from './connection';
import { StackFrame } from '../common/types'; import type { Logger } from './types';
export abstract class ChannelOwner<T extends channels.Channel = channels.Channel, Initializer = {}> extends EventEmitter { export abstract class ChannelOwner<T extends channels.Channel = channels.Channel, Initializer = {}> extends EventEmitter {
private _connection: Connection; private _connection: Connection;
@ -103,8 +102,8 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
} }
} }
_waitForEventInfoBefore(waitId: string, apiName: string, stack: StackFrame[]) { _waitForEventInfoBefore(waitId: string, apiName: string) {
this._connection.sendMessageToServer(this._guid, 'waitForEventInfo', { info: { apiName, waitId, phase: 'before', stack } }, undefined).catch(() => {}); this._connection.sendMessageToServer(this._guid, 'waitForEventInfo', { info: { apiName, waitId, phase: 'before' } }, undefined).catch(() => {});
} }
_waitForEventInfoAfter(waitId: string, error?: string) { _waitForEventInfoAfter(waitId: string, error?: string) {

View File

@ -15,7 +15,7 @@
*/ */
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { captureStackTrace, rewriteErrorMessage } from '../utils/stackTrace'; import { rewriteErrorMessage } from '../utils/stackTrace';
import { TimeoutError } from '../utils/errors'; import { TimeoutError } from '../utils/errors';
import { createGuid } from '../utils/utils'; import { createGuid } from '../utils/utils';
import { ChannelOwner } from './channelOwner'; import { ChannelOwner } from './channelOwner';
@ -32,7 +32,7 @@ export class Waiter {
constructor(channelOwner: ChannelOwner, apiName: string) { constructor(channelOwner: ChannelOwner, apiName: string) {
this._waitId = createGuid(); this._waitId = createGuid();
this._channelOwner = channelOwner; this._channelOwner = channelOwner;
this._channelOwner._waitForEventInfoBefore(this._waitId, apiName, captureStackTrace().frames); this._channelOwner._waitForEventInfoBefore(this._waitId, apiName);
this._dispose = [ this._dispose = [
() => this._channelOwner._waitForEventInfoAfter(this._waitId, this._error) () => this._channelOwner._waitForEventInfoAfter(this._waitId, this._error)
]; ];

View File

@ -220,7 +220,6 @@ export class DispatcherConnection {
switch (info.phase) { switch (info.phase) {
case 'before': case 'before':
callMetadata.apiName = info.apiName; callMetadata.apiName = info.apiName;
callMetadata.stack = info.stack;
this._waitOperations.set(info.waitId, callMetadata); this._waitOperations.set(info.waitId, callMetadata);
break; break;
case 'log': case 'log':

View File

@ -39,7 +39,6 @@ export type WaitForEventInfo = {
waitId: string, waitId: string,
phase: 'before' | 'after' | 'log', phase: 'before' | 'after' | 'log',
apiName?: string, apiName?: string,
stack?: StackFrame[],
message?: string, message?: string,
error?: string, error?: string,
}; };

View File

@ -42,9 +42,6 @@ WaitForEventInfo:
- after - after
- log - log
apiName: string? apiName: string?
stack:
type: array?
items: StackFrame
message: string? message: string?
error: string? error: string?

View File

@ -47,7 +47,6 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
waitId: tString, waitId: tString,
phase: tEnum(['before', 'after', 'log']), phase: tEnum(['before', 'after', 'log']),
apiName: tOptional(tString), apiName: tOptional(tString),
stack: tOptional(tArray(tType('StackFrame'))),
message: tOptional(tString), message: tOptional(tString),
error: tOptional(tString), error: tOptional(tString),
}); });