Detect Flipper reloads, to remove false positives in quick restart detection
Reviewed By: nikoant Differential Revision: D25783368 fbshipit-source-id: 35a9cbbbb5bac4c7b6b7b40c45db2055ff4cfa09
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c460cb767f
commit
cfd1c22814
@@ -7,7 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {ipcRenderer} from 'electron';
|
||||
import {ipcRenderer, remote} from 'electron';
|
||||
import {performance} from 'perf_hooks';
|
||||
import {EventEmitter} from 'events';
|
||||
|
||||
@@ -71,10 +71,13 @@ export default (store: Store, logger: Logger) => {
|
||||
|
||||
const oldExitData = loadExitData();
|
||||
if (oldExitData) {
|
||||
const isReload = remote.process.pid === oldExitData.pid;
|
||||
const timeSinceLastStartup =
|
||||
Date.now() - parseInt(oldExitData.lastSeen, 10);
|
||||
logger.track('usage', 'restart', {
|
||||
// console.log(isReload ? 'reload' : 'restart', oldExitData);
|
||||
logger.track('usage', isReload ? 'reload' : 'restart', {
|
||||
...oldExitData,
|
||||
pid: undefined,
|
||||
timeSinceLastStartup,
|
||||
});
|
||||
// create fresh exit data
|
||||
@@ -277,6 +280,7 @@ interface ExitData {
|
||||
plugin: string;
|
||||
app: string;
|
||||
cleanExit: boolean;
|
||||
pid: number;
|
||||
}
|
||||
|
||||
function loadExitData(): ExitData | undefined {
|
||||
@@ -317,6 +321,7 @@ export function persistExitData(
|
||||
plugin: state.selectedPlugin || '',
|
||||
app: state.selectedApp ? deconstructClientId(state.selectedApp).app : '',
|
||||
cleanExit,
|
||||
pid: remote.process.pid,
|
||||
};
|
||||
window.localStorage.setItem(
|
||||
flipperExitDataKey,
|
||||
|
||||
Reference in New Issue
Block a user