pinokiod 3.19.88 → 3.19.89

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/index.js +17 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.19.88",
3
+ "version": "3.19.89",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -4415,6 +4415,8 @@ class Server {
4415
4415
  }
4416
4416
  }))
4417
4417
  this.app.get("/git/*", ex(async (req, res) => {
4418
+ let d = Date.now()
4419
+ console.time("1 GET /git " + d)
4418
4420
  let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
4419
4421
  bin: this.kernel.bin.preset("dev"),
4420
4422
  })
@@ -4422,9 +4424,13 @@ class Server {
4422
4424
  res.redirect(`/setup/dev?callback=${req.originalUrl}`)
4423
4425
  return
4424
4426
  }
4427
+ console.timeEnd("1 GET /git " + d)
4428
+ console.time("2 GET /git " + d)
4425
4429
  let dir = this.kernel.path("api", req.params[0])
4426
4430
  let config = await this.kernel.git.config(dir)
4431
+ console.timeEnd("2 GET /git " + d)
4427
4432
 
4433
+ console.time("3 GET /git " + d)
4428
4434
  let hosts = ""
4429
4435
  let hosts_file = this.kernel.path("config/gh/hosts.yml")
4430
4436
  let e = await this.exists(hosts_file)
@@ -4437,6 +4443,7 @@ class Server {
4437
4443
  }
4438
4444
  }
4439
4445
  console.log("hosts", hosts)
4446
+ console.timeEnd("3 GET /git " + d)
4440
4447
 
4441
4448
  let connected = (hosts.length > 0)
4442
4449
  console.log({ connected })
@@ -4448,13 +4455,17 @@ class Server {
4448
4455
  }
4449
4456
  let changes = []
4450
4457
  try {
4458
+ console.time("4 GET /git " + d)
4451
4459
  const statusMatrix = await git.statusMatrix({ dir, fs });
4460
+ console.timeEnd("4 GET /git " + d)
4461
+ console.time("5 GET /git " + d)
4452
4462
  for (const [filepath, head, workdir, stage] of statusMatrix) {
4453
4463
  if (head !== workdir || head !== stage) {
4454
4464
  const fullPath = path.join(dir, filepath);
4455
4465
  let relpath = path.relative(this.kernel.homedir, fullPath)
4456
4466
  let webpath = "/asset/" + relpath
4457
4467
 
4468
+ console.time("6 GET /git " + d + " " + ilepath)
4458
4469
  // Skip if binary
4459
4470
  let binary = false;
4460
4471
  try {
@@ -4462,6 +4473,7 @@ class Server {
4462
4473
  } catch {
4463
4474
  binary = false; // fallback
4464
4475
  }
4476
+ console.timeEnd("6 GET /git " + d + " " + filepath)
4465
4477
 
4466
4478
  if (binary) {
4467
4479
  changes.push({
@@ -4476,6 +4488,7 @@ class Server {
4476
4488
  continue;
4477
4489
 
4478
4490
  } else {
4491
+ console.time("7 GET /git " + d + " " + filepath)
4479
4492
 
4480
4493
  let oldContent = "";
4481
4494
  let newContent = "";
@@ -4495,15 +4508,19 @@ class Server {
4495
4508
  } catch (e) {
4496
4509
  newContent = "";
4497
4510
  }
4511
+ console.timeEnd("7 GET /git " + d + " " + filepath)
4512
+ console.time("8 GET /git " + d + " " + filepath)
4498
4513
 
4499
4514
 
4500
4515
  const diffs = diff.diffLines(normalize(oldContent), normalize(newContent));
4501
4516
 
4502
4517
  const summarized = Util.diffLinesWithContext(diffs, 5);
4518
+ console.timeEnd("8 GET /git " + d + " " + filepath)
4503
4519
  changes.push({ webpath, file: filepath, path: fullPath, status: Util.classifyChange(head, workdir, stage)/*`${head}${workdir}${stage}`*/, diff: summarized, binary: false, });
4504
4520
  }
4505
4521
  }
4506
4522
  }
4523
+ console.timeEnd("5 GET /git " + d)
4507
4524
 
4508
4525
  } catch (err) {
4509
4526
  console.log("git status matrix error", err)