masterrecord 1.30.1 → 1.30.2

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/CHANGES.md +15 -0
  2. package/context.js +5 -4
  3. package/package.json +1 -1
package/CHANGES.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # MasterRecord Changelog
2
2
 
3
+ ## v1.30.2 — pool reuse is a debug message
4
+
5
+ Every context a server constructs reuses the process's connection pool, and each
6
+ reuse printed `[PostgreSQL] Reusing pool for <db> (refs: N)` (or `[MySQL] …`) with
7
+ `console.log`, whatever the log level. A long-running server writes thousands of
8
+ these a minute. In CodeBook's production log they buried the one line that said
9
+ why a deploy was failing.
10
+
11
+ Reuse now goes through the logger at `debug`, so it is hidden at the default
12
+ `info` level and visible with `configureLogging({ level: 'debug' })`. Creating a
13
+ pool, which happens once per process, is logged as before. Nothing else changed:
14
+ the refcount is unchanged and still only decides when an idle pool may close.
15
+
16
+ New test: `test/pool-reuse-log-level.test.js`.
17
+
3
18
  ## v1.30.1 — `baseline` is scoped to one context, as everything in EF is
4
19
 
5
20
  **Data-corrupting bug.** `baseline <ctx> --all` globbed `**/*_migration.js` from the working
package/context.js CHANGED
@@ -25,6 +25,7 @@ import deleteManager from './deleteManager.js';
25
25
  import EntityTrackerModel from './Entity/entityTrackerModel.js';
26
26
  import { ConcurrencyError } from './errors.js';
27
27
  import { withRetry } from './resilience.js';
28
+ import { log } from './logging.js';
28
29
  import { globSync } from 'glob';
29
30
  import fs from 'node:fs';
30
31
  import path from 'node:path';
@@ -532,13 +533,13 @@ class context {
532
533
  const result = await cached.promise;
533
534
  this._SQLEngine = result.engine;
534
535
  this.isMySQL = true;
535
- console.log(`[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
536
+ log('debug', `[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
536
537
  return result.client;
537
538
  }
538
539
  // Already resolved
539
540
  this._SQLEngine = cached.engine;
540
541
  this.isMySQL = true;
541
- console.log(`[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
542
+ log('debug', `[MySQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
542
543
  return cached.client;
543
544
  }
544
545
 
@@ -644,13 +645,13 @@ class context {
644
645
  const result = await cached.promise;
645
646
  this._SQLEngine = result.engine;
646
647
  this._SQLEngine.__name = sqlName;
647
- console.log(`[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
648
+ log('debug', `[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
648
649
  return result.pool;
649
650
  }
650
651
  // Already resolved
651
652
  this._SQLEngine = cached.engine;
652
653
  this._SQLEngine.__name = sqlName;
653
- console.log(`[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
654
+ log('debug', `[PostgreSQL] Reusing pool for ${env.database} (refs: ${cached.refCount})`);
654
655
  return cached.pool;
655
656
  }
656
657
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "masterrecord",
3
- "version": "1.30.1",
3
+ "version": "1.30.2",
4
4
  "description": "An Object-relational mapping for the Master framework. Master Record connects classes to relational database tables to establish a database with almost zero-configuration ",
5
5
  "type": "module",
6
6
  "main": "./MasterRecord.js",