Avoid registering wrong performance load logs (#8107)
This commit is contained in:
parent
a3ac7535f1
commit
26ae247d0f
3 changed files with 18 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
import {fetchConfigAndLicense} from '@actions/remote/systems';
|
import {fetchConfigAndLicense} from '@actions/remote/systems';
|
||||||
import DatabaseManager from '@database/manager';
|
import DatabaseManager from '@database/manager';
|
||||||
import {getServerCredentials} from '@init/credentials';
|
import {getServerCredentials} from '@init/credentials';
|
||||||
|
import PerformanceMetricsManager from '@managers/performance_metrics_manager';
|
||||||
import WebsocketManager from '@managers/websocket_manager';
|
import WebsocketManager from '@managers/websocket_manager';
|
||||||
|
|
||||||
type AfterLoginArgs = {
|
type AfterLoginArgs = {
|
||||||
|
|
@ -16,6 +17,11 @@ export async function loginEntry({serverUrl}: AfterLoginArgs): Promise<{error?:
|
||||||
return {error: `${serverUrl} database not found`};
|
return {error: `${serverUrl} database not found`};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There are cases where the target may be reset and a performance metric
|
||||||
|
// be added after login. This would be done with a wrong value, so we make
|
||||||
|
// sure we don't do this by skipping the load metric here.
|
||||||
|
PerformanceMetricsManager.skipLoadMetric();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const clData = await fetchConfigAndLicense(serverUrl, false);
|
const clData = await fetchConfigAndLicense(serverUrl, false);
|
||||||
if (clData.error) {
|
if (clData.error) {
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ class PerformanceMetricsManager {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public skipLoadMetric() {
|
||||||
|
this.hasRegisteredLoad = true;
|
||||||
|
}
|
||||||
|
|
||||||
public finishLoad(location: Target, serverUrl: string) {
|
public finishLoad(location: Target, serverUrl: string) {
|
||||||
this.finishLoadWithRetries(location, serverUrl, 0);
|
this.finishLoadWithRetries(location, serverUrl, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import {Appearance, BackHandler} from 'react-native';
|
||||||
import {getDefaultThemeByAppearance} from '@context/theme';
|
import {getDefaultThemeByAppearance} from '@context/theme';
|
||||||
import {DEFAULT_LOCALE, getTranslations} from '@i18n';
|
import {DEFAULT_LOCALE, getTranslations} from '@i18n';
|
||||||
import {initialize} from '@init/app';
|
import {initialize} from '@init/app';
|
||||||
|
import PerformanceMetricsManager from '@managers/performance_metrics_manager';
|
||||||
import {extractStartLink, isValidUrl} from '@utils/url';
|
import {extractStartLink, isValidUrl} from '@utils/url';
|
||||||
|
|
||||||
import ChannelsScreen from './screens/channels';
|
import ChannelsScreen from './screens/channels';
|
||||||
|
|
@ -63,6 +64,13 @@ const ShareExtension = () => {
|
||||||
return data?.filter((i) => !i.isString) || [];
|
return data?.filter((i) => !i.isString) || [];
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Since the share functionality inits the app, the init mark gets set
|
||||||
|
// at this point. Therefore, any check on load times after this is done
|
||||||
|
// over the wrong value.
|
||||||
|
PerformanceMetricsManager.skipLoadMetric();
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initialize().finally(async () => {
|
initialize().finally(async () => {
|
||||||
const items = await MattermostShare.getSharedData();
|
const items = await MattermostShare.getSharedData();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue