Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Proper handling of authentication error #180

Merged
merged 3 commits into from
Jul 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions packages/@best/runner-hub/src/HubClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ function proxifyRunner(benchmarkEntryBundle: BenchmarkInfo, projectConfig: Froze
socket.on('connect_error', (err: any) => {
console.log('Error in connection to agent > ', err);
reject(err);
})
});

socket.on('error', (err: any) => {
console.log('Error in connection to agent > ', err);
reject(err);
});

socket.on('connect', () => {
if (cancelledRun) {
Expand Down Expand Up @@ -109,11 +114,6 @@ function proxifyRunner(benchmarkEntryBundle: BenchmarkInfo, projectConfig: Froze
resolve(result);
});

socket.on('error', (err: any) => {
console.log('Error in connection to agent > ', err);
reject(err);
});

socket.emit('benchmark_task', {
benchmarkName,
benchmarkFolder,
Expand Down Expand Up @@ -160,15 +160,15 @@ export class HubClient {
console.log('Error in connection to agent > ', err);
resolved = true;
reject(err);
})
});

socket.on('connect', () => {
socket.on('error', (err: any) => {
console.log('Error in connection to agent > ', err);
resolved = true;
reject(err);
});
socket.on('error', (err: any) => {
console.log('Error in connection to agent > ', err);
resolved = true;
reject(err);
});

socket.on('connect', () => {
socket.on('disconnect', (reason: string) => {
if (!resolved) {
resolved = true;
Expand Down
15 changes: 10 additions & 5 deletions packages/@best/runner-remote/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ function proxifyRunner(benchmarkEntryBundle: BenchmarkInfo, projectConfig: Froze

const socket = socketIO(host, normalizedSocketOptions);

socket.on('connect_error', (err: any) => {
console.log('Error in connection to agent > ', err);
reject(err);
});

socket.on('error', (err: any) => {
console.log('Error in connection to agent > ', err);
reject(err);
});

socket.on('connect', () => {
socket.on('load_benchmark', () => {
const uploader = new SocketIOFile(socket);
Expand Down Expand Up @@ -70,11 +80,6 @@ function proxifyRunner(benchmarkEntryBundle: BenchmarkInfo, projectConfig: Froze
}
});

socket.on('error', (err: any) => {
console.log('Error in connection to agent > ', err);
reject(err);
});

socket.on('benchmark_error', (err: any) => {
console.log(err);
reject(new Error('Benchmark couldn\'t finish running. '));
Expand Down