Skip to content

Commit 5c740f2

Browse files
authored
Merge pull request #92 from datapartyjs/service-tasks
Fix bug in loading native node service tasks
2 parents 0f0ed94 + eee8dcc commit 5c740f2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"body-parser": "^1.19.0",
7171
"bson": "^4.6.1",
7272
"bson-objectid": "^1.3.0",
73+
"bufferutil": "^4.0.8",
7374
"colors": "1.3.1",
7475
"cors": "^2.8.5",
7576
"debug": "^3.1.0",
@@ -105,10 +106,9 @@
105106
"tingodb": "^0.6.1",
106107
"touch": "^3.1.0",
107108
"url-parse": "^1.4.7",
109+
"utf-8-validate": "^5.0.10",
108110
"uuid": "^3.2.1",
109-
"uuidv4": "^6.2.12",
110111
"vm2": "^3.9.2",
111-
"websocket": "https://github.com/sevenbitbyte/WebSocket-Node#parcel-build",
112112
"ws": "^8.11.0",
113113
"zangodb": "https://github.com/sevenbitbyte/zangodb#hash-patch"
114114
},

src/service/service-runner-node.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ class ServiceRunnerNode {
104104
let TaskClass = null
105105

106106
if(!this.useNative){
107+
var self={}
107108
const build = Hoek.reach(this.service, `compiled.tasks.${name}`)
108-
TaskClass = eval(build.code/*, build.map*/)
109+
eval(build.code/*, build.map*/)
110+
TaskClass = self.Lib
109111
}
110112
else{
111113
TaskClass = this.service.constructors.tasks[name]
@@ -138,16 +140,18 @@ class ServiceRunnerNode {
138140
debug('spawnTask', type, 'useNative =',this.useNative)
139141

140142
let dt = new DeltaTime().start()
141-
143+
142144

143145
"use strict"
144146
let task=null
145147

146148
let TaskClass = null
147149

148150
if(!this.useNative){
151+
var self={}
149152
const build = Hoek.reach(this.service, `compiled.tasks.${type}`)
150-
TaskClass = eval(build.code/*, build.map*/)
153+
eval(build.code/*, build.map*/)
154+
TaskClass = self.Lib
151155
}
152156
else{
153157
TaskClass = this.service.constructors.tasks[type]
@@ -435,4 +439,4 @@ class ServiceRunnerNode {
435439
}
436440
}
437441

438-
module.exports = ServiceRunnerNode
442+
module.exports = ServiceRunnerNode

0 commit comments

Comments
 (0)