anbaric-cloud-hosting 1.9.0 → 1.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anbaric-cloud-hosting",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Anbaric Cloud hosting service: Postgres-backed job persistence and queuing exposed over an HTTP API",
5
5
  "license": "MIT",
6
6
  "author": "chris@anbaric.ai",
@@ -18,17 +18,17 @@
18
18
  "@aws-sdk/client-s3": "^3.1110.0",
19
19
  "@aws-sdk/client-secrets-manager": "^3.700.0",
20
20
  "@aws-sdk/client-servicediscovery": "^3.1110.0",
21
- "anbaric-data-store": "^1.9.0",
22
- "anbaric-plugins": "^1.9.0",
23
- "anbaric-tsapi": "^1.9.0",
21
+ "anbaric-data-store": "^1.11.0",
22
+ "anbaric-plugins": "^1.11.0",
23
+ "anbaric-tsapi": "^1.11.0",
24
24
  "esbuild": "^0.28.2",
25
25
  "pg": "^8.16.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^26.2.0",
29
29
  "@types/pg": "^8.15.0",
30
- "anbaric-impl-cloud": "^1.9.0",
31
- "anbaric-state-machine": "^1.9.0",
30
+ "anbaric-impl-cloud": "^1.11.0",
31
+ "anbaric-state-machine": "^1.11.0",
32
32
  "tsx": "^4.20.0",
33
33
  "typescript": "^7.0.2"
34
34
  },
@@ -23,8 +23,8 @@ class QueueHandler implements RequestHandler {
23
23
  case "dequeue":
24
24
  return request.reply(200, { messages: await this.queue.dequeueSome() });
25
25
  case "confirm": {
26
- const { jobId, workflowId } = await request.body();
27
- await this.queue.confirm({ jobId, workflowId });
26
+ const { jobId, workflowId, position } = await request.body();
27
+ await this.queue.confirm({ jobId, workflowId, position });
28
28
  return request.reply(204);
29
29
  }
30
30
  }
@@ -39,14 +39,12 @@ class PostgresQueue implements ConfirmableQueue {
39
39
  if (!b.due) return 1;
40
40
  return a.due.getTime() - b.due.getTime() || a.position - b.position;
41
41
  })
42
- .map(row => ({ jobId: row.job_id, workflowId: row.workflow_id }));
42
+ .map(row => ({ jobId: row.job_id, workflowId: row.workflow_id, position: Number(row.position) }));
43
43
  }
44
44
 
45
45
  async confirm(message : QueueMessage) : Promise<void> {
46
- await this.pool.query(
47
- "DELETE FROM queue WHERE job_id = $1 AND workflow_id = $2",
48
- [message.jobId, message.workflowId],
49
- );
46
+ if (message.position === undefined) return;
47
+ await this.pool.query("DELETE FROM queue WHERE position = $1", [message.position]);
50
48
  }
51
49
 
52
50
  }