582 lines
28 KiB
JavaScript
582 lines
28 KiB
JavaScript
/* Metro module 1172; source: unknown; dependencies: [57, 27, 826, 1130, 1164, 1167] */
|
|
import Module00057 from './module-00057.js'; /* Metro dependency 57 */
|
|
import * as ReactNativeModule from './module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as Module01130Module from './module-01130.js'; /* Metro dependency 1130 */
|
|
|
|
function _fun13029(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#13029, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:6, offset: 0x00dde370, size: 106 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
exports.stallTrackingIntegration = stallTrackingIntegration;
|
|
function stallTrackingIntegration() { // fn#13030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:152, offset: 0x00dde3da, size: 292 bytes, params: 1, frame: 15
|
|
var backgroundEventListener;
|
|
const value = undefined;
|
|
let r0 = arguments.length > 0 && value !== arguments[0] ? arguments[0] : {};
|
|
const minimumStallThresholdMs = r0.minimumStallThresholdMs;
|
|
r0 = value === minimumStallThresholdMs ? 50 : minimumStallThresholdMs;
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
const object = {'isTracking': false, 'timeout': null, 'isBackground': false, 'lastIntervalMs': 0,
|
|
'totalStallTime': 0, 'stallCount': 0};
|
|
object.backgroundEventListener = backgroundEventListener;
|
|
object.iteration = iteration;
|
|
if (AppState == null ? value : AppState.isAvailable) {
|
|
AppState.addEventListener('change', object.backgroundEventListener);
|
|
}
|
|
return {name: 'StallTracking', setup: function(a0) {
|
|
a0.on('spanStart', _onSpanStart);
|
|
a0.on('spanEnd', _onSpanEnd);
|
|
}, _internalState: object};
|
|
function backgroundEventListener(a0) { // fn#13031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:423, owner: stallTrackingIntegration.backgroundEventListener, offset: 0x00dde4fe, size: 176 bytes, params: 2, frame: 13
|
|
var binding;
|
|
var value2;
|
|
if (a0 === 'active') {
|
|
Module00057.isBackground = false;
|
|
if (Module00057.timeout != null) {
|
|
binding = Module00057;
|
|
value2 = environment.__proto__;
|
|
binding.lastIntervalMs = 1000 * (require(826) /* metro dependency 826 */).timestampInSeconds();
|
|
binding = Module00057;
|
|
binding.iteration();
|
|
}
|
|
} else {
|
|
Module00057.isBackground = true;
|
|
if (Module00057.timeout !== null) {
|
|
global.clearTimeout(Module00057.timeout);
|
|
}
|
|
}
|
|
}
|
|
|
|
function iteration() { // fn#13032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:648, owner: stallTrackingIntegration.iteration, offset: 0x00dde5ae, size: 397 bytes, params: 1, frame: 35
|
|
var r5;
|
|
var r17;
|
|
var r2;
|
|
var value;
|
|
var moduleValue;
|
|
var timestampInSeconds;
|
|
var value2;
|
|
var value3;
|
|
var value4;
|
|
var lastIntervalMs;
|
|
var value5;
|
|
var value6;
|
|
var binding;
|
|
var stallCount;
|
|
var totalStallTime;
|
|
var entries;
|
|
var iterator;
|
|
var iterator2;
|
|
var value7;
|
|
var item;
|
|
var item2;
|
|
var value8;
|
|
var property;
|
|
var property2;
|
|
var Math;
|
|
var max;
|
|
var longestStallTime;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var set;
|
|
var Object;
|
|
var assign;
|
|
var Object2;
|
|
var assign2;
|
|
var object;
|
|
var value12;
|
|
var value13;
|
|
var error;
|
|
var isTracking;
|
|
var isBackground;
|
|
var setTimeout;
|
|
var iteration;
|
|
exceptionSkip32: while (true) {
|
|
exceptionLanding32: while (true) {
|
|
value = environment.__proto__;
|
|
moduleValue = require(826) /* metro dependency 826 */;
|
|
timestampInSeconds = moduleValue.timestampInSeconds;
|
|
value2 = Reflect.apply(timestampInSeconds, moduleValue, []);
|
|
value3 = 1000 * value2;
|
|
value4 = environment;
|
|
lastIntervalMs = Module00057.lastIntervalMs;
|
|
value5 = value3 - lastIntervalMs;
|
|
if (value5 >= 50 + env0_0) {
|
|
value6 = value5 - 50;
|
|
binding = Module00057;
|
|
stallCount = binding.stallCount;
|
|
binding.stallCount = stallCount + 1;
|
|
binding = Module00057;
|
|
totalStallTime = binding.totalStallTime;
|
|
binding.totalStallTime = totalStallTime + value6;
|
|
binding = env0_1;
|
|
entries = binding.entries;
|
|
iterator = Reflect.apply(entries, binding, [])[Symbol.iterator]();
|
|
iterator2 = iterator.next;
|
|
value7 = 0;
|
|
r5 = iterator;
|
|
while (true) {
|
|
item2 = Reflect.apply(iterator2, r5, []);
|
|
item = item2.value;
|
|
item2 = item2.done ? undefined : r5;
|
|
if (item2 === undefined) {
|
|
break;
|
|
}
|
|
try {
|
|
binding = env1_2;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
value8 = binding(item, 2);
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
property = value8[value7];
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
property2 = value8[1];
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
Math = global.Math;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
max = Math.max;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
longestStallTime = property2.longestStallTime;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
value9 = longestStallTime === null;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
if (value9) {
|
|
r17 = value7;
|
|
continue;
|
|
}
|
|
try {
|
|
value10 = longestStallTime === undefined;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
if (value10) {
|
|
r17 = value7;
|
|
continue;
|
|
}
|
|
r17 = longestStallTime;
|
|
try {
|
|
value11 = Reflect.apply(max, Math, [r17, value6]);
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
binding = env0_1;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
set = binding.set;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
Object = global.Object;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
assign = Object.assign;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
Object2 = global.Object;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
assign2 = Object2.assign;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
value12 = Reflect.apply(assign2, Object2, [object, property2]);
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
object.longestStallTime = value11;
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
value13 = Reflect.apply(assign, Object, [value12, object]);
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
try {
|
|
Reflect.apply(set, binding, [property, value13]);
|
|
} catch (error) {
|
|
break exceptionLanding32;
|
|
}
|
|
r5 = item2;
|
|
}
|
|
}
|
|
Module00057.lastIntervalMs = value3;
|
|
isTracking = Module00057.isTracking;
|
|
if (isTracking) {
|
|
isBackground = Module00057.isBackground;
|
|
value = !isBackground;
|
|
r2 = value;
|
|
} else {
|
|
r2 = isTracking;
|
|
}
|
|
if (r2) {
|
|
binding = Module00057;
|
|
setTimeout = global.setTimeout;
|
|
iteration = Module00057.iteration;
|
|
binding.timeout = setTimeout(iteration, 50);
|
|
}
|
|
return undefined;
|
|
break exceptionSkip32;
|
|
}
|
|
try {
|
|
item2.return();
|
|
} catch {
|
|
}
|
|
throw error;
|
|
break exceptionSkip32;
|
|
}
|
|
}
|
|
|
|
function _onSpanStart(a0) { // fn#13033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:1063, owner: stallTrackingIntegration._onSpanStart, offset: 0x00dde73b, size: 163 bytes, params: 2, frame: 17
|
|
var binding;
|
|
var set;
|
|
var object;
|
|
if (Module01130Module.isRootSpan(a0)) {
|
|
binding = env0_1;
|
|
if (binding.has(a0)) {
|
|
(require(826) /* metro dependency 826 */).debug.error('[StallTracking] Tried to start stall tracking on a transaction already being tracked. Measurements might be lost.');
|
|
} else {
|
|
_startTracking();
|
|
binding = env0_1;
|
|
set = binding.set;
|
|
object = {'longestStallTime': 0, 'atTimestamp': null};
|
|
object.atStart = _getCurrentStats(a0);
|
|
Reflect.apply(set, binding, [a0, object]);
|
|
_flushLeakedTransactions();
|
|
}
|
|
}
|
|
}
|
|
|
|
function _onSpanEnd(a0) { // fn#13034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:1332, owner: stallTrackingIntegration._onSpanEnd, offset: 0x00dde7de, size: 715 bytes, params: 2, frame: 25
|
|
var r1;
|
|
var binding;
|
|
var value4;
|
|
var moduleValue2;
|
|
var debug;
|
|
var log;
|
|
var timestamp;
|
|
var moduleValue3;
|
|
var latestChildSpanEndTimestamp;
|
|
var setSpanMeasurement;
|
|
var STALL_COUNT;
|
|
var stall_count;
|
|
var value8;
|
|
var atStart;
|
|
var value10;
|
|
var unit;
|
|
var STALL_TOTAL_TIME;
|
|
var stall_total_time;
|
|
var value11;
|
|
var value13;
|
|
var STALL_LONGEST_TIME;
|
|
var stall_longest_time;
|
|
var value14;
|
|
let value = environment.__proto__;
|
|
const value2 = undefined;
|
|
if ((require(1130) /* metro dependency 1130 */).isRootSpan(a0)) {
|
|
binding = env0_1;
|
|
value4 = binding.get(a0);
|
|
moduleValue2 = require(826) /* metro dependency 826 */;
|
|
if (value4) {
|
|
timestamp = moduleValue2.spanToJSON(a0).timestamp;
|
|
moduleValue3 = require(1164) /* metro dependency 1164 */;
|
|
if (moduleValue3.isNearToNow(timestamp)) {
|
|
r1 = _getCurrentStats(a0);
|
|
} else {
|
|
latestChildSpanEndTimestamp = (require(1164) /* metro dependency 1164 */).getLatestChildSpanEndTimestamp(a0);
|
|
if (latestChildSpanEndTimestamp !== timestamp) {
|
|
(require(826) /* metro dependency 826 */).debug.log('[StallTracking] Stall measurements not added due to a custom `endTimestamp` (root end is not equal to the latest child span end).');
|
|
}
|
|
if (!value4.atTimestamp) {
|
|
(require(826) /* metro dependency 826 */).debug.log('[StallTracking] Stall measurements not added due to `endTimestamp` not being close to now. And no previous stats from child end were found.');
|
|
}
|
|
r1 = latestChildSpanEndTimestamp === timestamp && value4.atTimestamp ? value4.atTimestamp.stats : value2;
|
|
}
|
|
env0_1.delete(a0);
|
|
_shouldStopTracking();
|
|
if (r1) {
|
|
value = require(1164) /* metro dependency 1164 */;
|
|
setSpanMeasurement = value.setSpanMeasurement;
|
|
STALL_COUNT = (require(1167) /* metro dependency 1167 */).STALL_COUNT;
|
|
stall_count = r1.stall_count;
|
|
value8 = stall_count.value;
|
|
atStart = value4.atStart;
|
|
stall_count = atStart.stall_count;
|
|
value10 = value8 - stall_count.value;
|
|
atStart = value4.atStart;
|
|
stall_count = atStart.stall_count;
|
|
unit = stall_count.unit;
|
|
Reflect.apply(setSpanMeasurement, value, [a0, STALL_COUNT, value10, unit]);
|
|
value = require(1164) /* metro dependency 1164 */;
|
|
setSpanMeasurement = value.setSpanMeasurement;
|
|
STALL_TOTAL_TIME = (require(1167) /* metro dependency 1167 */).STALL_TOTAL_TIME;
|
|
stall_total_time = r1.stall_total_time;
|
|
value11 = stall_total_time.value;
|
|
atStart = value4.atStart;
|
|
stall_total_time = atStart.stall_total_time;
|
|
value13 = value11 - stall_total_time.value;
|
|
atStart = value4.atStart;
|
|
stall_total_time = atStart.stall_total_time;
|
|
unit = stall_total_time.unit;
|
|
Reflect.apply(setSpanMeasurement, value, [a0, STALL_TOTAL_TIME, value13, unit]);
|
|
value = require(1164) /* metro dependency 1164 */;
|
|
setSpanMeasurement = value.setSpanMeasurement;
|
|
STALL_LONGEST_TIME = (require(1167) /* metro dependency 1167 */).STALL_LONGEST_TIME;
|
|
stall_longest_time = r1.stall_longest_time;
|
|
value14 = stall_longest_time.value;
|
|
stall_longest_time = r1.stall_longest_time;
|
|
unit = stall_longest_time.unit;
|
|
Reflect.apply(setSpanMeasurement, value, [a0, STALL_LONGEST_TIME, value14, unit]);
|
|
} else if (value2 !== timestamp) {
|
|
debug = (require(826) /* metro dependency 826 */).debug;
|
|
log = debug.log;
|
|
value = require(826) /* metro dependency 826 */;
|
|
value = value.timestampInSeconds();
|
|
Reflect.apply(log, debug,
|
|
['[StallTracking] Stall measurements not added due to `endTimestamp` not being close to now.',
|
|
'endTimestamp',
|
|
timestamp, 'now', value]);
|
|
}
|
|
return value2;
|
|
}
|
|
debug = moduleValue2.debug;
|
|
debug.log('[StallTracking] Stall measurements were not added to transaction due to exceeding the max count.');
|
|
binding = env0_1;
|
|
binding.delete(a0);
|
|
_shouldStopTracking();
|
|
return value2;
|
|
}
|
|
return _onChildSpanEnd(a0);
|
|
}
|
|
|
|
function _onChildSpanEnd(a0) { // fn#13035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:2645, owner: stallTrackingIntegration._onChildSpanEnd, offset: 0x00ddeaa9, size: 83 bytes, params: 2, frame: 16
|
|
let value = environment.__proto__;
|
|
value = require(826) /* metro dependency 826 */;
|
|
value = value.getRootSpan(a0);
|
|
const moduleValue = require(826) /* metro dependency 826 */;
|
|
const timestamp = moduleValue.spanToJSON(a0).timestamp;
|
|
if (timestamp) {
|
|
_markSpanFinish(value, timestamp);
|
|
}
|
|
}
|
|
|
|
function _markSpanFinish(a0, a1) { // fn#13036, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:2749, owner: stallTrackingIntegration._markSpanFinish, offset: 0x00ddeafc, size: 317 bytes, params: 3, frame: 25
|
|
var Math;
|
|
var abs;
|
|
var value3;
|
|
var moduleValue;
|
|
var set;
|
|
var Object;
|
|
var assign;
|
|
var value5;
|
|
var object2;
|
|
let binding = env0_1;
|
|
const value2 = binding.get(a0);
|
|
if (value2) {
|
|
Math = global.Math;
|
|
abs = Math.abs;
|
|
value3 = environment.__proto__;
|
|
moduleValue = require(826) /* metro dependency 826 */;
|
|
if (Reflect.apply(abs, Math, [moduleValue.timestampInSeconds() - a1]) > 0.02) {
|
|
(require(826) /* metro dependency 826 */).debug.log('[StallTracking] Span end not logged due to end timestamp being outside the margin of error from now.');
|
|
if (value2.atTimestamp && value2.atTimestamp.timestamp < a1) {
|
|
binding = env0_1;
|
|
set = binding.set;
|
|
Object = global.Object;
|
|
Reflect.apply(set, binding, [a0, Object.assign(global.Object.assign({}, value2), {atTimestamp: null})]);
|
|
}
|
|
} else {
|
|
binding = env0_1;
|
|
set = binding.set;
|
|
Object = global.Object;
|
|
assign = Object.assign;
|
|
value5 = global.Object.assign({}, value2);
|
|
object2 = {timestamp: a1};
|
|
object2.stats = _getCurrentStats(a0);
|
|
Reflect.apply(set, binding, [a0, Reflect.apply(assign, Object, [value5, {atTimestamp: object2}])]);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _getCurrentStats(a0) { // fn#13037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:3159, owner: stallTrackingIntegration._getCurrentStats, offset: 0x00ddec39, size: 137 bytes, params: 2, frame: 16
|
|
const object = {};
|
|
object.stall_count = {value: Module00057.stallCount, unit: 'none'};
|
|
object.stall_total_time = {value: Module00057.totalStallTime, unit: 'millisecond'};
|
|
const value = env0_1.get(a0);
|
|
const value2 = undefined;
|
|
const longestStallTime = value === null || value2 === value ? value2 : value.longestStallTime;
|
|
object.stall_longest_time = {value: longestStallTime === null || value2 === longestStallTime ? 0 : longestStallTime,
|
|
unit: 'millisecond'};
|
|
return object;
|
|
}
|
|
|
|
function _startTracking() { // fn#13038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:3444, owner: stallTrackingIntegration._startTracking, offset: 0x00ddecc2, size: 120 bytes, params: 1, frame: 15
|
|
var binding;
|
|
var Math;
|
|
var floor;
|
|
var value2;
|
|
if (!Module00057.isTracking) {
|
|
Module00057.isTracking = true;
|
|
binding = Module00057;
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
value2 = environment.__proto__;
|
|
binding.lastIntervalMs = Reflect.apply(floor, Math,
|
|
[1000 * (require(826) /* metro dependency 826 */).timestampInSeconds()]);
|
|
binding = Module00057;
|
|
binding.iteration();
|
|
}
|
|
}
|
|
|
|
function _shouldStopTracking() { // fn#13039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:3581, owner: stallTrackingIntegration._shouldStopTracking, offset: 0x00dded3a, size: 95 bytes, params: 1, frame: 13
|
|
if (env0_1.size === 0) {
|
|
Module00057.isTracking = false;
|
|
if (Module00057.timeout !== null) {
|
|
global.clearTimeout(Module00057.timeout);
|
|
Module00057.timeout = null;
|
|
}
|
|
_reset();
|
|
}
|
|
}
|
|
|
|
function _reset() { // fn#13040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:3734, owner: stallTrackingIntegration._reset, offset: 0x00dded99, size: 53 bytes, params: 1, frame: 10
|
|
Module00057.stallCount = 0;
|
|
Module00057.totalStallTime = 0;
|
|
Module00057.lastIntervalMs = 0;
|
|
env0_1.clear();
|
|
}
|
|
|
|
function _flushLeakedTransactions() { // fn#13041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1299:3818, owner: stallTrackingIntegration._flushLeakedTransactions, offset: 0x00ddedce, size: 128 bytes, params: 1, frame: 19
|
|
var r2;
|
|
var r5;
|
|
var value;
|
|
var size;
|
|
var value2;
|
|
var value3;
|
|
var binding;
|
|
var keys;
|
|
var iterator;
|
|
var iterator2;
|
|
var item;
|
|
var item2;
|
|
var value4;
|
|
var value5;
|
|
var property;
|
|
var error;
|
|
exceptionSkip12: while (true) {
|
|
exceptionLanding12: while (true) {
|
|
value = environment;
|
|
size = env0_1.size;
|
|
if (size > 10) {
|
|
value2 = 0;
|
|
size = env0_1.size;
|
|
value3 = size - 10;
|
|
binding = env0_1;
|
|
keys = binding.keys;
|
|
iterator = Reflect.apply(keys, binding, [])[Symbol.iterator]();
|
|
iterator2 = iterator.next;
|
|
r2 = iterator;
|
|
r5 = value2;
|
|
loopExit2: while (true) {
|
|
item2 = Reflect.apply(iterator2, r2, []);
|
|
item = item2.value;
|
|
item2 = item2.done ? undefined : r2;
|
|
if (item2 === undefined) {
|
|
break loopExit2;
|
|
}
|
|
try {
|
|
value4 = r5 >= value3;
|
|
} catch (error) {
|
|
break exceptionLanding12;
|
|
}
|
|
if (value4) {
|
|
item2.return();
|
|
break loopExit2;
|
|
}
|
|
try {
|
|
value5 = r5 + 1;
|
|
} catch (error) {
|
|
break exceptionLanding12;
|
|
}
|
|
try {
|
|
binding = env0_1;
|
|
} catch (error) {
|
|
break exceptionLanding12;
|
|
}
|
|
try {
|
|
property = binding.delete;
|
|
} catch (error) {
|
|
break exceptionLanding12;
|
|
}
|
|
try {
|
|
Reflect.apply(property, binding, [item]);
|
|
} catch (error) {
|
|
break exceptionLanding12;
|
|
}
|
|
r2 = item2;
|
|
r5 = value5;
|
|
}
|
|
}
|
|
return undefined;
|
|
break exceptionSkip12;
|
|
}
|
|
try {
|
|
item2.return();
|
|
} catch {
|
|
}
|
|
throw error;
|
|
break exceptionSkip12;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun13029, 1172, [57, 27, 826, 1130, 1164,
|
|
1167]) /* metro module 1172, dependencies: [57, 27, 826, 1130, 1164, 1167] */;
|