forked from Ivasoft/mattermost-mobile
Set 5s as default timeout for ping (#6271)
This commit is contained in:
@@ -244,6 +244,10 @@ export default class ClientBase {
|
||||
retryLimit: 0,
|
||||
};
|
||||
}
|
||||
if (options.timeoutInterval) {
|
||||
requestOptions.timeoutInterval = options.timeoutInterval;
|
||||
}
|
||||
|
||||
let response: ClientResponse;
|
||||
try {
|
||||
response = await request!(url, requestOptions);
|
||||
|
||||
@@ -7,7 +7,7 @@ import ClientError from './error';
|
||||
|
||||
export interface ClientGeneralMix {
|
||||
getOpenGraphMetadata: (url: string) => Promise<any>;
|
||||
ping: (deviceId?: string) => Promise<any>;
|
||||
ping: (deviceId?: string, timeoutInterval?: number) => Promise<any>;
|
||||
logClientError: (message: string, level?: string) => Promise<any>;
|
||||
getClientConfigOld: () => Promise<ClientConfig>;
|
||||
getClientLicenseOld: () => Promise<ClientLicense>;
|
||||
@@ -25,14 +25,14 @@ const ClientGeneral = (superclass: any) => class extends superclass {
|
||||
);
|
||||
};
|
||||
|
||||
ping = async (deviceId?: string) => {
|
||||
ping = async (deviceId?: string, timeoutInterval?: number) => {
|
||||
let url = `${this.urlVersion}/system/ping?time=${Date.now()}`;
|
||||
if (deviceId) {
|
||||
url = `${url}&device_id=${deviceId}`;
|
||||
}
|
||||
return this.doFetch(
|
||||
url,
|
||||
{method: 'get'},
|
||||
{method: 'get', timeoutInterval},
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user