blind-peer 2.8.3 → 2.9.0

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 (3) hide show
  1. package/bin.js +16 -0
  2. package/index.js +2 -0
  3. package/package.json +2 -2
package/bin.js CHANGED
@@ -60,6 +60,10 @@ const cmd = command(
60
60
  '--repl [repl]',
61
61
  'Expose a repl-swarm at the passed-in seed (32 bytes in hex or z32 notation). Use for debugging only.'
62
62
  ),
63
+ flag(
64
+ '--auto-shutdown-minutes [auto-shutdown-minutes]',
65
+ '(Temporary, Advanced) Automatically shut the process down after X minutes, with a variation of 20%'
66
+ ),
63
67
  async function ({ flags }) {
64
68
  const debug = flags.debug
65
69
  const logger = pino({
@@ -290,6 +294,18 @@ const cmd = command(
290
294
 
291
295
  logger.info(`Listening at ${idEnc.normalize(blindPeer.publicKey)}`)
292
296
  logger.info(`Encryption public key is ${idEnc.normalize(blindPeer.encryptionPublicKey)}`)
297
+
298
+ if (flags.autoShutdownMinutes) {
299
+ const delay = flags.autoShutdownMinutes * (1 + Math.random() / 5)
300
+ logger.warn(`Automatically shutting down the process in ${delay} minutes`)
301
+ setTimeout(
302
+ () => {
303
+ logger.warn('Auto-shutdown triggered. Shutting down...')
304
+ goodbye.exit()
305
+ },
306
+ delay * 60 * 1000
307
+ )
308
+ }
293
309
  }
294
310
  )
295
311
 
package/index.js CHANGED
@@ -527,6 +527,8 @@ class BlindPeer extends ReadyResource {
527
527
  }
528
528
 
529
529
  registerMetrics(promClient) {
530
+ this.wakeup.registerMetrics(promClient)
531
+
530
532
  const self = this
531
533
  new promClient.Gauge({
532
534
  // eslint-disable-line no-new
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blind-peer",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
4
4
  "description": "Blind peers help keep hypercores available",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "paparam": "^1.8.0",
25
25
  "pino": "^9.6.0",
26
26
  "protomux-rpc": "^1.7.1",
27
- "protomux-wakeup": "^2.6.0",
27
+ "protomux-wakeup": "^2.7.0",
28
28
  "ready-resource": "^1.1.2",
29
29
  "repl-swarm": "^2.3.0",
30
30
  "rocksdb-native": "^3.1.6",