@unchainedshop/core-worker 4.8.9 → 4.8.11

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.
@@ -1,4 +1,4 @@
1
- import { isDocumentDBCompatModeEnabled } from '@unchainedshop/mongodb';
1
+ import {} from '@unchainedshop/mongodb';
2
2
  import { buildDbIndexes } from '@unchainedshop/mongodb';
3
3
  const ONE_DAY_IN_SECONDS = 86400;
4
4
  export const WorkStatus = {
@@ -10,34 +10,32 @@ export const WorkStatus = {
10
10
  };
11
11
  export const WorkQueueCollection = async (db) => {
12
12
  const WorkQueue = db.collection('work_queue');
13
- if (!isDocumentDBCompatModeEnabled()) {
14
- await buildDbIndexes(WorkQueue, [
15
- {
16
- index: { originalWorkId: 'text', _id: 'text', worker: 'text', input: 'text', type: 'text' },
17
- options: {
18
- weights: {
19
- _id: 8,
20
- originalWorkId: 6,
21
- type: 5,
22
- worker: 4,
23
- input: 2,
24
- },
25
- name: 'workqueue_fulltext_search',
13
+ await buildDbIndexes(WorkQueue, [
14
+ {
15
+ index: { originalWorkId: 'text', _id: 'text', worker: 'text', input: 'text', type: 'text' },
16
+ options: {
17
+ weights: {
18
+ _id: 8,
19
+ originalWorkId: 6,
20
+ type: 5,
21
+ worker: 4,
22
+ input: 2,
26
23
  },
24
+ name: 'workqueue_fulltext_search',
27
25
  },
28
- ]);
29
- }
26
+ },
27
+ ]);
30
28
  await buildDbIndexes(WorkQueue, [
31
29
  {
32
30
  index: { created: -1 },
33
31
  options: { expireAfterSeconds: 30 * ONE_DAY_IN_SECONDS },
34
32
  },
35
- { index: { started: -1 } },
36
- { index: { finished: 1 } },
37
- { index: { scheduled: 1 } },
38
- { index: { priority: -1 } },
33
+ { index: { scheduled: 1, type: 1 } },
39
34
  { index: { type: 1 } },
40
35
  { index: { originalWorkId: 1 } },
36
+ { index: { started: 1 }, options: { sparse: true } },
37
+ { index: { finished: 1 }, options: { sparse: true } },
38
+ { index: { priority: -1 } },
41
39
  ]);
42
40
  return WorkQueue;
43
41
  };
@@ -1,6 +1,6 @@
1
1
  import os from 'node:os';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
- import { generateDbFilterById, buildSortOptions, generateDbObjectId, assertDocumentDBCompatMode, } from '@unchainedshop/mongodb';
3
+ import { generateDbFilterById, buildSortOptions, generateDbObjectId, } from '@unchainedshop/mongodb';
4
4
  import { emit, registerEvents } from '@unchainedshop/events';
5
5
  import { buildObfuscatedFieldsFilter, SortDirection, } from '@unchainedshop/utils';
6
6
  import { WorkQueueCollection, WorkStatus } from "../db/WorkQueueCollection.js";
@@ -58,7 +58,6 @@ export const buildQuerySelector = ({ created, scheduled, types, status, workId,
58
58
  query = generateDbFilterById(workId, query);
59
59
  }
60
60
  if (queryString) {
61
- assertDocumentDBCompatMode();
62
61
  query.$text = { $search: queryString };
63
62
  }
64
63
  return { ...query, ...rest };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-worker",
3
3
  "description": "Background job and task queue module for the Unchained Engine",
4
- "version": "4.8.9",
4
+ "version": "4.8.11",
5
5
  "main": "lib/worker-index.js",
6
6
  "types": "lib/worker-index.d.ts",
7
7
  "type": "module",