pinokiod 3.2.148 → 3.2.149

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.
@@ -6,8 +6,40 @@ class Python {
6
6
  }
7
7
  async call(modname, modpath, method, args, ondata) {
8
8
  console.log("CALL", { modname, modpath, method, args })
9
+ let res
10
+ for(let i=0; i<5; i++) {
11
+ console.log(`call attempt: ${i}`)
12
+ ondata({
13
+ raw: `\r\ncall attempt: ${i}\r\n`
14
+ })
15
+ res = await this._call(modname, modpath, method, args, ondata)
16
+ if (res) {
17
+ console.log("request successful")
18
+ ondata({
19
+ raw: "\r\nrequest successful\r\n"
20
+ })
21
+ break
22
+ } else {
23
+ console.log("request unsuccessful. retrying in 3 seconds...")
24
+ ondata({
25
+ raw: "\r\nrequest successful. retrying in 3 seconds...\r\n"
26
+ })
27
+ await new Promise((resolve, reject) => {
28
+ setTimeout(() => {
29
+ resolve()
30
+ }, 3000)
31
+ })
32
+ }
33
+ }
34
+ return res
35
+ }
36
+ async _call(modname, modpath, method, args, ondata) {
9
37
  // if this.proc doesn't exist, create
10
38
  if (!this.proc) {
39
+ console.log("python rpc server not running. starting...")
40
+ ondata({
41
+ raw: "\r\npython rpc server not running. starting...\r\n"
42
+ })
11
43
  await new Promise((resolve, reject) => {
12
44
  this.kernel.exec({
13
45
  message: "uvicorn --port 42001 server:app",
@@ -20,12 +52,6 @@ class Python {
20
52
  }
21
53
  })
22
54
  })
23
- console.log("Server Started")
24
- await new Promise((resolve, reject) => {
25
- setTimeout(() => {
26
- resolve()
27
- }, 3000)
28
- })
29
55
  }
30
56
 
31
57
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.148",
3
+ "version": "3.2.149",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {