dobo 2.36.2 → 2.37.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.
@@ -28,6 +28,7 @@ async function memoryAdapterFactory () {
28
28
  async connect (connection, noRebuild) {
29
29
  const conn = this.plugin.getConnection('memory')
30
30
  const { fs } = this.app.lib
31
+ const { setInterval } = this.app.lib
31
32
  const dir = `${this.app.getPluginDataDir(this.plugin.ns)}/memDb/data` // persistence dir
32
33
  fs.ensureDirSync(dir)
33
34
  conn.persistences = conn.persistences ?? []
@@ -51,7 +52,7 @@ async function memoryAdapterFactory () {
51
52
  else this.storage[model.name] = data
52
53
  } else await model.loadFixtures({ ignoreError: false })
53
54
  }
54
- setInterval(() => {
55
+ async function handler () {
55
56
  if (!this.saving) return
56
57
  this.saving = true
57
58
  for (const model of models) {
@@ -61,7 +62,9 @@ async function memoryAdapterFactory () {
61
62
  } catch (err) {}
62
63
  }
63
64
  this.saving = false
64
- }, this.plugin.config.memDb.persistenceDur)
65
+ }
66
+
67
+ await setInterval(handler, this.plugin.config.memDb.persistenceDur, { lockFile: 'memDbPersistence', scope: this })
65
68
  }
66
69
 
67
70
  async _getOldRecord (model, id, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "2.36.2",
3
+ "version": "2.37.0",
4
4
  "description": "DBMS for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-08-06
4
+
5
+ - [2.37.0] Update `memory.connect()` to use the new `app.lib.setInterval()`
6
+
3
7
  ## 2026-08-03
4
8
 
5
9
  - [2.36.2] Bug fix in `model.rebuildModel()`