Skip to content

Commit

Permalink
Increase activation timeout for ADB only to 10s
Browse files Browse the repository at this point in the history
With emulators (e.g. Genymotion) and an initial fresh install of
the app, setup can take longer than the one second that the API
allows by default, so we boost that a little, to better track
interceptor success rates and spot issues.
  • Loading branch information
pimterry committed Oct 16, 2020
1 parent 09a2f49 commit cf3ea7e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const buildResolvers = (
isActivable: (interceptor: Interceptor) => {
return withFallback(
interceptor.isActivable(),
INTERCEPTOR_TIMEOUT,
interceptor.activationTimeout || INTERCEPTOR_TIMEOUT,
false
);
},
Expand Down
2 changes: 2 additions & 0 deletions src/interceptors/android/android-adb-interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export class AndroidAdbInterceptor implements Interceptor {
};
}

activationTimeout = 10000; // Increase timeout for this interceptor to 10s, as initial setup takes a while

async activate(proxyPort: number, options: {
deviceId: string
}): Promise<void | {}> {
Expand Down
2 changes: 2 additions & 0 deletions src/interceptors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface Interceptor {
isActive(proxyPort: number): boolean;

activate(proxyPort: number, options?: any): Promise<void | {}>;
activationTimeout?: number;

deactivate(proxyPort: number, options?: any): Promise<void | {}>;
deactivateAll(): Promise<void | {}>;
}
Expand Down

0 comments on commit cf3ea7e

Please sign in to comment.