socket-function 0.12.2 → 0.12.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -16,7 +16,10 @@ import pako from "pako";
16
16
  import { setFlag } from "../require/compileFlags";
17
17
  setFlag(require, "pako", "allowclient", true);
18
18
 
19
- const MIN_RETRY_DELAY = 1000;
19
+ // NOTE: If it is too low, and too many servers disconnect, we can easily spend 100% of our time
20
+ // trying to reconnect.
21
+ // (Or... maybe the delay is just waiting, and we aren't actually overloading the server?)
22
+ const MIN_RETRY_DELAY = 5000;
20
23
 
21
24
  type InternalCallType = FullCallType & {
22
25
  seqNum: number;
@@ -91,7 +91,11 @@ export class JSONLACKS {
91
91
  if (extendedParsing) {
92
92
  obj = measureBlock(function JSONextendedParse() { return parser.parse(text); });
93
93
  } else {
94
- obj = measureBlock(function JSONparse() { return JSON.parse(text); });
94
+ try {
95
+ obj = measureBlock(function JSONparse() { return JSON.parse(text); });
96
+ } catch {
97
+ obj = measureBlock(function JSONextendedParse() { return parser.parse(text); });
98
+ }
95
99
  }
96
100
 
97
101
  return JSONLACKS.hydrateSpecialObjects(obj, hydrateState, config) as T;
@@ -178,7 +178,8 @@ export function logMeasureTable(
178
178
  title += extraInfos.map(x => x ? ` // ${x}` : "").join("");
179
179
  process.stdout.write(`\x1b]0;${title}\x07`);
180
180
  }
181
- let title = yellow(`Profiled ${formatTime(totalTime)} (${percent(fraction)} CPU)${extraInfos.map(x => x ? ` (${x})` : "")} (logged at ${new Date().toISOString()}, profile for ${formatTime(timeRunFor)})`);
181
+ let pid = isNode() ? `(${process.pid}) ` : "";
182
+ let title = yellow(`${pid}Profiled ${formatTime(totalTime)} (${percent(fraction)} CPU)${extraInfos.map(x => x ? ` (${x})` : "")} (logged at ${new Date().toISOString()}, profile for ${formatTime(timeRunFor)})`);
182
183
  if (name) {
183
184
  title = `(${blue(name)}) ${title}`;
184
185
  }