mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-17 00:56:22 +00:00
Check for REALM_DISABLE_ANALYTICS earlier in submit-analytics.js
Node's `require()` is synchronous and somewhat slow, so importing the modules for submit-analytics.js ends up being about half of the runtime of `require('realm')`. With this change, when analytics is disabled, nearly all of the time spent on `require('realm')` (~100ms on my machine) is spent in node-pre-gyp-related functionality for loading the native module.
This commit is contained in:
parent
4bcef8baff
commit
f4b96a1782
@ -25,6 +25,11 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
if ('REALM_DISABLE_ANALYTICS' in process.env) {
|
||||
module.exports = function(){};
|
||||
return;
|
||||
}
|
||||
|
||||
const os = require('os');
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
@ -69,9 +74,6 @@ function getAnonymizedMachineIdentifier() {
|
||||
}
|
||||
|
||||
module.exports = function(eventName) {
|
||||
if ('REALM_DISABLE_ANALYTICS' in process.env)
|
||||
return;
|
||||
|
||||
const identifier = getAnonymizedMachineIdentifier();
|
||||
const payload = {
|
||||
'event': eventName,
|
||||
|
Loading…
x
Reference in New Issue
Block a user