safelaunch 1.0.30 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/telemetry.js +18 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safelaunch",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Backend Reliability Infrastructure - catch what breaks production before it breaks",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/telemetry.js CHANGED
@@ -1,22 +1,29 @@
1
1
  const { PostHog } = require('posthog-node');
2
2
 
3
3
  const client = new PostHog('phc_WFm3O5H7wkZK2Ne3kyy5QgUXJR8y86SQbszSwk3BUn0', {
4
- host: 'https://us.i.posthog.com'
4
+ host: 'https://us.i.posthog.com',
5
+ flushAt: 1,
6
+ flushInterval: 0,
5
7
  });
6
8
 
7
9
  function track(event, properties = {}) {
8
- client.capture({
9
- distinctId: 'anonymous',
10
- event,
11
- properties: {
12
- ...properties,
13
- cli_version: require('../../package.json').version,
14
- }
15
- });
10
+ try {
11
+ client.capture({
12
+ distinctId: 'anonymous',
13
+ event,
14
+ properties: {
15
+ ...properties,
16
+ cli_version: require('../package.json').version,
17
+ }
18
+ });
19
+ } catch {}
16
20
  }
17
21
 
18
22
  async function shutdown() {
19
- await client.shutdown();
23
+ try {
24
+ await client.flush();
25
+ await client.shutdown();
26
+ } catch {}
20
27
  }
21
28
 
22
- module.exports = { track, shutdown };
29
+ module.exports = { track, shutdown };