rian 0.0.2-alpha.8 → 0.0.2-alpha.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +4 -3
  2. package/index.mjs +4 -3
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -9,8 +9,8 @@ const measure = (cb, scope, promises) => {
9
9
  });
10
10
  };
11
11
  try {
12
- const r = cb();
13
- if (r instanceof Promise)
12
+ var r = cb(), is_promise = r instanceof Promise;
13
+ if (is_promise)
14
14
  promises.push(r.catch(set_error).finally(() => scope.end()));
15
15
  return r;
16
16
  }
@@ -19,7 +19,8 @@ const measure = (cb, scope, promises) => {
19
19
  throw e;
20
20
  }
21
21
  finally {
22
- scope.end();
22
+ if (is_promise !== true)
23
+ scope.end();
23
24
  }
24
25
  };
25
26
  const create = (name, options) => {
package/index.mjs CHANGED
@@ -7,8 +7,8 @@ const measure = (cb, scope, promises) => {
7
7
  });
8
8
  };
9
9
  try {
10
- const r = cb();
11
- if (r instanceof Promise)
10
+ var r = cb(), is_promise = r instanceof Promise;
11
+ if (is_promise)
12
12
  promises.push(r.catch(set_error).finally(() => scope.end()));
13
13
  return r;
14
14
  }
@@ -17,7 +17,8 @@ const measure = (cb, scope, promises) => {
17
17
  throw e;
18
18
  }
19
19
  finally {
20
- scope.end();
20
+ if (is_promise !== true)
21
+ scope.end();
21
22
  }
22
23
  };
23
24
  const create = (name, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rian",
3
- "version": "0.0.2-alpha.8",
3
+ "version": "0.0.2-alpha.9",
4
4
  "description": "A tracer for the edge",
5
5
  "keywords": [
6
6
  "TODO"