@muze-nl/simplystore 0.3.5 → 0.3.6
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 +1 -1
- package/src/commands.mjs +1 -0
- package/src/server.mjs +3 -3
- package/src/worker-command-init.mjs +2 -1
- package/src/worker-command.mjs +3 -3
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
package/src/server.mjs
CHANGED
|
@@ -37,7 +37,7 @@ async function main(options) {
|
|
|
37
37
|
|
|
38
38
|
let queryWorkerpool = initWorkerPool(queryWorker)
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const commandWorkerpool = initWorkerPool(commandWorker,1) // only one update worker so no changes can get lost
|
|
41
41
|
|
|
42
42
|
server.get('/', (req,res) => {
|
|
43
43
|
res.send('<h1>SimplyStore</h1>') //@TODO: implement something nice
|
|
@@ -224,8 +224,8 @@ async function main(options) {
|
|
|
224
224
|
let dataspace = JSONTag.parse(jsontag)
|
|
225
225
|
//@TODO: make sure queryWorkerpool is only replaced after
|
|
226
226
|
//workers are initialized, to prevent hickups if initialization takes a long time
|
|
227
|
-
let newQueryWorkerpool = initWorkerPool(
|
|
228
|
-
queryWorkerpool.
|
|
227
|
+
let newQueryWorkerpool = initWorkerPool(queryWorker)
|
|
228
|
+
queryWorkerpool.destroy() // gracefully
|
|
229
229
|
queryWorkerpool = newQueryWorkerpool
|
|
230
230
|
//@TODO: write dataspace to disk
|
|
231
231
|
status.set(command.id, 'done')
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as commandWorker from './worker-command.mjs'
|
|
2
2
|
import worker_threads from 'node:worker_threads'
|
|
3
|
+
import JSONTag from '@muze-nl/jsontag'
|
|
3
4
|
|
|
4
5
|
async function initialize() {
|
|
5
6
|
let meta = {}
|
|
6
7
|
let dataspace = JSONTag.parse(worker_threads.workerData, null, meta)
|
|
7
|
-
await commandWorker.initialize(
|
|
8
|
+
await commandWorker.initialize(dataspace,meta)
|
|
8
9
|
return commandWorker.runCommand
|
|
9
10
|
}
|
|
10
11
|
|
package/src/worker-command.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import commands from './commands.mjs'
|
|
|
7
7
|
* and type+attribute data gets lost
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
let dataspace
|
|
10
|
+
let dataspace, meta
|
|
11
11
|
|
|
12
12
|
export function setDataspace(d) {
|
|
13
13
|
dataspace = d
|
|
@@ -19,10 +19,10 @@ export function setDataspace(d) {
|
|
|
19
19
|
* @TODO: setTimeout or do above checks in server.mjs before queueing
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
export function
|
|
22
|
+
export async function initialize(jsontag, m) {
|
|
23
23
|
if (!jsontag) { throw new Error('missing jsontag parameter')}
|
|
24
24
|
dataspace = jsontag
|
|
25
|
-
|
|
25
|
+
meta = m
|
|
26
26
|
return true
|
|
27
27
|
}
|
|
28
28
|
|