Skip to content

Commit cf3ea7e

Browse files
committed
Increase activation timeout for ADB only to 10s
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.
1 parent 09a2f49 commit cf3ea7e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/api-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ const buildResolvers = (
154154
isActivable: (interceptor: Interceptor) => {
155155
return withFallback(
156156
interceptor.isActivable(),
157-
INTERCEPTOR_TIMEOUT,
157+
interceptor.activationTimeout || INTERCEPTOR_TIMEOUT,
158158
false
159159
);
160160
},

src/interceptors/android/android-adb-interceptor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export class AndroidAdbInterceptor implements Interceptor {
5454
};
5555
}
5656

57+
activationTimeout = 10000; // Increase timeout for this interceptor to 10s, as initial setup takes a while
58+
5759
async activate(proxyPort: number, options: {
5860
deviceId: string
5961
}): Promise<void | {}> {

src/interceptors/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export interface Interceptor {
3232
isActive(proxyPort: number): boolean;
3333

3434
activate(proxyPort: number, options?: any): Promise<void | {}>;
35+
activationTimeout?: number;
36+
3537
deactivate(proxyPort: number, options?: any): Promise<void | {}>;
3638
deactivateAll(): Promise<void | {}>;
3739
}

0 commit comments

Comments
 (0)