You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -7,6 +14,29 @@ import { registerApiKeyAuth } from '../../plugins/apikey'
7
14
8
15
const{ pgQueueEnable }=getConfig()
9
16
17
+
functiongetQueueOverflowStore(){
18
+
returnnewQueueOverflowStorePg(Queue.getDb())
19
+
}
20
+
21
+
constnonBlankStringSchema={
22
+
type: 'string',
23
+
minLength: 1,
24
+
pattern: '\\S',
25
+
}asconst
26
+
27
+
conststringListSchema={
28
+
type: 'array',
29
+
minItems: 1,
30
+
maxItems: 1000,
31
+
items: nonBlankStringSchema,
32
+
}asconst
33
+
34
+
constpositiveSafeIntegerSchema={
35
+
type: 'integer',
36
+
minimum: 1,
37
+
maximum: Number.MAX_SAFE_INTEGER,
38
+
}asconst
39
+
10
40
constmoveJobsSchema={
11
41
body: {
12
42
type: 'object',
@@ -26,10 +56,106 @@ const moveJobsSchema = {
26
56
},
27
57
}asconst
28
58
59
+
constlistQueueOverflowSchema={
60
+
description: 'List created pgBoss jobs from the live queue table or overflow backup table.',
61
+
querystring: {
62
+
type: 'object',
63
+
properties: {
64
+
source: {
65
+
type: 'string',
66
+
enum: ['job','backup'],
67
+
default: 'job',
68
+
},
69
+
groupBy: {
70
+
type: 'string',
71
+
enum: ['summary','tenant'],
72
+
default: 'summary',
73
+
},
74
+
name: nonBlankStringSchema,
75
+
eventTypes: {
76
+
...nonBlankStringSchema,
77
+
description: 'Comma-separated event types to filter on.',
78
+
},
79
+
tenantRefs: {
80
+
...nonBlankStringSchema,
81
+
description: 'Comma-separated tenant refs to filter on.',
82
+
},
83
+
limit: {
84
+
...positiveSafeIntegerSchema,
85
+
default: JOB_OVERFLOW_LIST_LIMIT_DEFAULT,
86
+
},
87
+
},
88
+
additionalProperties: false,
89
+
},
90
+
}asconst
91
+
92
+
constcountQueueOverflowSchema={
93
+
description: 'Count created pgBoss jobs in the live queue table.',
94
+
}asconst
95
+
96
+
constbackupQueueOverflowSchema={
97
+
description: 'Move created pgBoss jobs into the overflow backup table.',
98
+
body: {
99
+
type: 'object',
100
+
properties: {
101
+
name: nonBlankStringSchema,
102
+
eventTypes: stringListSchema,
103
+
tenantRefs: stringListSchema,
104
+
limit: positiveSafeIntegerSchema,
105
+
confirmAll: {
106
+
type: 'boolean',
107
+
description: 'Required when no queue, event type, or tenant filter is supplied.',
108
+
},
109
+
},
110
+
anyOf: [
111
+
{required: ['name']},
112
+
{required: ['eventTypes']},
113
+
{required: ['tenantRefs']},
114
+
{
115
+
properties: {
116
+
confirmAll: {type: 'boolean',enum: [true]},
117
+
},
118
+
required: ['confirmAll'],
119
+
},
120
+
],
121
+
additionalProperties: false,
122
+
},
123
+
}asconst
124
+
125
+
constrestoreQueueOverflowSchema={
126
+
description:
127
+
'Restore created pgBoss jobs from the overflow backup table in batches. Conflicting rows are dropped from the backup table because the live job table wins.',
0 commit comments