@arkstack/queue 0.17.1 → 0.17.2

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.
@@ -241,7 +241,7 @@ var DatabaseQueue = class extends QueueContract {
241
241
  * @returns
242
242
  */
243
243
  availableQuery(db, queue) {
244
- return db.table(this.options.table).where({ queue }).whereNull("reserved_at").where("available_at", "<=", now$1());
244
+ return db.table(this.options.table).where({ queue }).whereNull("reserved_at").whereRaw("available_at <= " + now$1());
245
245
  }
246
246
  };
247
247
  //#endregion
@@ -1,5 +1,6 @@
1
- import { t as Queue } from "../QueueManager-DXaqZVYl.js";
1
+ import { t as Queue } from "../QueueManager-C1GIAwK2.js";
2
2
  import { Command } from "@h3ravel/musket";
3
+ import { bootArkorm } from "@arkstack/database";
3
4
  //#region src/commands/QueueClearCommand.ts
4
5
  /**
5
6
  * Delete all of the jobs from a queue.
@@ -13,6 +14,9 @@ var QueueClearCommand = class extends Command {
13
14
  async handle() {
14
15
  const connection = this.argument("connection");
15
16
  const queue = this.option("queue");
17
+ try {
18
+ bootArkorm();
19
+ } catch {}
16
20
  const count = await Queue.connection(connection).clear(queue);
17
21
  this.info(`Cleared ${count} job(s) from the [${connection ?? "default"}] connection.`);
18
22
  }
@@ -1,5 +1,6 @@
1
- import { t as Queue } from "../QueueManager-DXaqZVYl.js";
1
+ import { t as Queue } from "../QueueManager-C1GIAwK2.js";
2
2
  import { Command } from "@h3ravel/musket";
3
+ import { bootArkorm } from "@arkstack/database";
3
4
  //#region src/commands/QueueWorkCommand.ts
4
5
  /**
5
6
  * Process jobs from a queue connection.
@@ -24,6 +25,9 @@ var QueueWorkCommand = class extends Command {
24
25
  return;
25
26
  }
26
27
  this.info(`Processing jobs from [${connection ?? "default"}] connection.`);
28
+ try {
29
+ bootArkorm();
30
+ } catch {}
27
31
  await worker.daemon({
28
32
  queue,
29
33
  sleep: Number(this.option("sleep") ?? 3),
package/dist/index.d.ts CHANGED
@@ -202,7 +202,7 @@ interface JobRow {
202
202
  */
203
203
  interface Query {
204
204
  where(where: Record<string, unknown>): Query;
205
- where(column: string, operator: string, value: unknown): Query;
205
+ whereRaw(sql: string, bindings?: unknown[] | undefined): Query;
206
206
  whereNull(column: string): Query;
207
207
  orderBy(orderBy: Record<string, 'asc' | 'desc'>): Query;
208
208
  first(): Promise<JobRow | null>;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as RedisQueue, c as Job, d as serializeJob, f as setResolver, i as SyncQueue, l as resetSerialization, n as configure, o as DatabaseQueue, p as setSerializer, r as Worker, s as QueueContract, t as Queue, u as resolveJob } from "./QueueManager-DXaqZVYl.js";
1
+ import { a as RedisQueue, c as Job, d as serializeJob, f as setResolver, i as SyncQueue, l as resetSerialization, n as configure, o as DatabaseQueue, p as setSerializer, r as Worker, s as QueueContract, t as Queue, u as resolveJob } from "./QueueManager-C1GIAwK2.js";
2
2
  export { DatabaseQueue, Job, Queue, QueueContract, RedisQueue, SyncQueue, Worker, configure, resetSerialization, resolveJob, serializeJob, setResolver, setSerializer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/queue",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "type": "module",
5
5
  "description": "Queue module for Arkstack, providing a driver based queue transport and worker for background processing.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/queue",
@@ -34,13 +34,13 @@
34
34
  "./package.json": "./package.json"
35
35
  },
36
36
  "dependencies": {
37
- "@arkstack/common": "^0.17.1"
37
+ "@arkstack/common": "^0.17.2"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@h3ravel/musket": "^2.2.2",
41
41
  "ioredis": "^5.4.1",
42
- "@arkstack/contract": "^0.17.1",
43
- "@arkstack/database": "^0.17.1"
42
+ "@arkstack/contract": "^0.17.2",
43
+ "@arkstack/database": "^0.17.2"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "@arkstack/database": {
@@ -34,7 +34,7 @@ export default (): QueueConfig => {
34
34
  host: env('REDIS_HOST', '127.0.0.1'),
35
35
  port: env('REDIS_PORT', 6379),
36
36
  password: env('REDIS_PASSWORD'),
37
- db: env('REDIS_QUEUE_DB', 2),
37
+ db: env('REDIS_QUEUE_DB', 0),
38
38
  queue: env('QUEUE_NAME', 'default'),
39
39
  retryAfter: env('QUEUE_RETRY_AFTER', 90),
40
40
  },