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.
- package/extend/dobo/adapter/memory.js +5 -2
- package/package.json +1 -1
- package/wiki/CHANGES.md +4 -0
|
@@ -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
|
-
|
|
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
|
-
}
|
|
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