n8n-nodes-bozonx-redis-sugar 1.20.0 → 1.22.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/README.md +40 -5
- package/dist/nodes/RedisListSugar/BozonxRedisListSugar.node.d.ts +5 -0
- package/dist/nodes/RedisListSugar/BozonxRedisListSugar.node.js +250 -0
- package/dist/nodes/RedisListSugar/BozonxRedisListSugar.node.js.map +1 -0
- package/dist/nodes/RedisListSugar/redis-list-sugar.svg +6 -0
- package/dist/nodes/RedisListSugar/redisClient.d.ts +10 -0
- package/dist/nodes/RedisListSugar/redisClient.js +97 -0
- package/dist/nodes/RedisListSugar/redisClient.js.map +1 -0
- package/dist/nodes/RedisQueueComplete/BozonxRedisQueueComplete.node.js +3 -3
- package/dist/nodes/RedisQueueComplete/BozonxRedisQueueComplete.node.js.map +1 -1
- package/dist/nodes/RedisQueueConsumer/BozonxRedisQueueConsumer.node.js +15 -4
- package/dist/nodes/RedisQueueConsumer/BozonxRedisQueueConsumer.node.js.map +1 -1
- package/dist/nodes/RedisQueueProducer/BozonxRedisQueueProducer.node.js +5 -4
- package/dist/nodes/RedisQueueProducer/BozonxRedisQueueProducer.node.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Community nodes for n8n to work with Redis:
|
|
|
8
8
|
- **Redis Queue Add**: add jobs to a Redis-based queue
|
|
9
9
|
- **Redis Queue Trigger**: process jobs from a Redis-based queue
|
|
10
10
|
- **Redis Queue Complete**: mark queue job as complete and check if it was the last job
|
|
11
|
+
- **Redis List Sugar**: manage simple lists with YAML/JSON parsing
|
|
11
12
|
|
|
12
13
|
n8n is a fair-code licensed workflow automation platform: https://n8n.io/
|
|
13
14
|
|
|
@@ -82,13 +83,13 @@ Emitted item example:
|
|
|
82
83
|
|
|
83
84
|
### 4) Redis Queue Add
|
|
84
85
|
|
|
85
|
-
Add jobs to a Redis-based queue for sequential processing.
|
|
86
|
+
Add jobs to a Redis-based queue for **strictly sequential** (one-by-one) processing. This queue is designed to handle tasks that must not run in parallel for the same Job Name.
|
|
86
87
|
|
|
87
88
|
- **Queue ID**: unique identifier for the queue (leave empty to use current workflow ID)
|
|
88
|
-
- **Job Name**: optional name to group jobs within the same queue (e.g., separate queues per user: `user-123`)
|
|
89
|
+
- **Job Name**: optional name to group jobs within the same queue (e.g., separate queues per user: `user-123`). Jobs with the same Name are processed strictly one-by-one.
|
|
89
90
|
- **Data**: job data in YAML/JSON format (leave empty to use incoming item)
|
|
90
|
-
- **
|
|
91
|
-
-
|
|
91
|
+
- **Lock TTL (seconds)**: maximum allowed processing time for the job. If the job isn't finished within this time, the producer will error out and the lock will eventually expire, allowing the next job to start.
|
|
92
|
+
- **Response Timeout (seconds)**: how long the Producer should wait for the Worker to finish before giving up with an error.
|
|
92
93
|
|
|
93
94
|
**Redis structure:**
|
|
94
95
|
- Without Job Name: `queue:{queueId}`
|
|
@@ -150,7 +151,41 @@ Output:
|
|
|
150
151
|
```
|
|
151
152
|
|
|
152
153
|
- `isLast`: `true` if this was the last job in the queue (queue is now empty)
|
|
153
|
-
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### Understanding the Queue (Concurrency & Locks)
|
|
158
|
+
|
|
159
|
+
#### Strictly Sequential Execution
|
|
160
|
+
This queue implementation is **intentionally non-concurrent**.
|
|
161
|
+
- Within a single `Queue ID` + `Job Name` combination, only **one job is processed at a time**.
|
|
162
|
+
- If a new job is added while another is running, it will stay in the Redis list until the current job calls **Redis Queue Complete**.
|
|
163
|
+
- Different `Job Names` (e.g., different users) are processed in parallel.
|
|
164
|
+
|
|
165
|
+
#### The "Leaked Lock" Problem
|
|
166
|
+
If a consumer workflow crashes or stops before reaching the **Redis Queue Complete** node, the queue for that specific `Job Name` will "freeze" because the lock key still exists in Redis.
|
|
167
|
+
|
|
168
|
+
**How to fix/prevent this:**
|
|
169
|
+
1. **Set a reasonable Lock TTL**: Don't use 1 hour if your task takes 10 seconds. The queue will automatically unfreeze once the TTL expires.
|
|
170
|
+
2. **Use Error Handling**: In n8n, create an **Error Stub** or use the **Error Trigger** node to call the **Redis Queue Complete** node even if your main logic fails.
|
|
171
|
+
3. **Manual Release**: You can manually delete the lock key in Redis to unfreeze the queue. The key format is `queue:{queueId}:{jobName}:lock`.
|
|
172
|
+
|
|
173
|
+
### 7) Redis List Sugar
|
|
174
|
+
|
|
175
|
+
Manage simple Redis lists (linked lists). Supports basic operations with YAML/JSON value parsing.
|
|
176
|
+
|
|
177
|
+
- **List ID**: Redis key for the list
|
|
178
|
+
- **Operation**:
|
|
179
|
+
- **Add Element**: Append value to the end of the list (`RPUSH`)
|
|
180
|
+
- **Delete Element (by Value)**: Remove all matching elements from the list (`LREM`)
|
|
181
|
+
- **Delete Element (at Index)**: Remove an element at a specific index
|
|
182
|
+
- **Get Range / All Elements**: Retrieve elements as an array (`LRANGE`). Supports pagination via Range Start and Range End.
|
|
183
|
+
- **Replace Element**: Update value at a specific index (`LSET`)
|
|
184
|
+
- **Clear List**: Delete the entire key (`DEL`)
|
|
185
|
+
|
|
186
|
+
**Details**:
|
|
187
|
+
- **Value (YAML/JSON)**: Input is parsed as YAML/JSON if possible. This allows storing structured objects as strings in the list. On retrieval, the node attempts to parse strings back to JSON objects.
|
|
188
|
+
- **Index / Range**: Zero-based. Negative numbers (e.g., `-1` for the last element, `0` to `-1` for all elements) are supported.
|
|
154
189
|
|
|
155
190
|
## Quick Start
|
|
156
191
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class BozonxRedisListSugar implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BozonxRedisListSugar = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const js_yaml_1 = require("js-yaml");
|
|
6
|
+
const redisClient_1 = require("./redisClient");
|
|
7
|
+
class BozonxRedisListSugar {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.description = {
|
|
10
|
+
displayName: 'Redis List Sugar',
|
|
11
|
+
name: 'bozonxRedisListSugar',
|
|
12
|
+
group: ['output'],
|
|
13
|
+
version: 1,
|
|
14
|
+
description: 'Manage simple lists in Redis',
|
|
15
|
+
defaults: { name: 'Redis List Sugar' },
|
|
16
|
+
icon: 'file:redis-list-sugar.svg',
|
|
17
|
+
inputs: ['main'],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'bozonxRedis',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'List ID',
|
|
28
|
+
name: 'listId',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
required: true,
|
|
32
|
+
description: 'Redis key name for the list',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Operation',
|
|
36
|
+
name: 'operation',
|
|
37
|
+
type: 'options',
|
|
38
|
+
noDataExpression: true,
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
name: 'Add Element',
|
|
42
|
+
value: 'add',
|
|
43
|
+
description: 'Add an element to the end of the list (RPUSH)',
|
|
44
|
+
action: 'Add an element to the end of the list',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Delete Element (by Value)',
|
|
48
|
+
value: 'deleteValue',
|
|
49
|
+
description: 'Remove occurrences of a value from the list (LREM)',
|
|
50
|
+
action: 'Remove occurrences of a value from the list',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Delete Element (at Index)',
|
|
54
|
+
value: 'deleteIndex',
|
|
55
|
+
description: 'Remove an element at a specific index',
|
|
56
|
+
action: 'Remove an element at a specific index',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Get Range / All Elements',
|
|
60
|
+
value: 'getAll',
|
|
61
|
+
description: 'Retrieve elements from the list (LRANGE)',
|
|
62
|
+
action: 'Retrieve elements from the list',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Replace Element',
|
|
66
|
+
value: 'replace',
|
|
67
|
+
description: 'Replace an element at a specific index (LSET)',
|
|
68
|
+
action: 'Replace an element at a specific index',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Clear List',
|
|
72
|
+
value: 'clear',
|
|
73
|
+
description: 'Delete the entire list (DEL)',
|
|
74
|
+
action: 'Delete the entire list',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
default: 'add',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Value (YAML / JSON)',
|
|
81
|
+
name: 'value',
|
|
82
|
+
type: 'string',
|
|
83
|
+
typeOptions: {
|
|
84
|
+
rows: 5,
|
|
85
|
+
},
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
operation: ['add', 'replace', 'deleteValue'],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
default: '',
|
|
92
|
+
description: 'Data in YAML or JSON format. If a string is provided, it will first be parsed as YAML, then as JSON. If it remains a string, it will be saved as a string.',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Index',
|
|
96
|
+
name: 'index',
|
|
97
|
+
type: 'number',
|
|
98
|
+
displayOptions: {
|
|
99
|
+
show: {
|
|
100
|
+
operation: ['replace', 'deleteIndex'],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
default: 0,
|
|
104
|
+
description: 'The zero-based index of the element. Use negative numbers to count from the end (-1 is last).',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Range Start',
|
|
108
|
+
name: 'rangeStart',
|
|
109
|
+
type: 'number',
|
|
110
|
+
displayOptions: {
|
|
111
|
+
show: {
|
|
112
|
+
operation: ['getAll'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
default: 0,
|
|
116
|
+
description: 'The starting index of the range. 0 is the first element.',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
displayName: 'Range End',
|
|
120
|
+
name: 'rangeEnd',
|
|
121
|
+
type: 'number',
|
|
122
|
+
displayOptions: {
|
|
123
|
+
show: {
|
|
124
|
+
operation: ['getAll'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
default: -1,
|
|
128
|
+
description: 'The ending index of the range. Use -1 for the last element, -2 for the second to last, etc.',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Include Other Input Fields',
|
|
132
|
+
name: 'includeInputFields',
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
default: false,
|
|
135
|
+
description: 'Whether to copy all input data to the output. When enabled, the node result will be placed in a "result" field.',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
usableAsTool: true,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async execute() {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const items = this.getInputData();
|
|
144
|
+
const returnData = [];
|
|
145
|
+
const creds = await this.getCredentials('bozonxRedis');
|
|
146
|
+
const host = (creds === null || creds === void 0 ? void 0 : creds.host) || 'localhost';
|
|
147
|
+
const port = (_a = creds === null || creds === void 0 ? void 0 : creds.port) !== null && _a !== void 0 ? _a : 6379;
|
|
148
|
+
const username = (creds === null || creds === void 0 ? void 0 : creds.username) || '';
|
|
149
|
+
const password = (creds === null || creds === void 0 ? void 0 : creds.password) || '';
|
|
150
|
+
const tls = (creds === null || creds === void 0 ? void 0 : creds.tls) || false;
|
|
151
|
+
const db = (_b = creds === null || creds === void 0 ? void 0 : creds.db) !== null && _b !== void 0 ? _b : 0;
|
|
152
|
+
const client = await (0, redisClient_1.getRedisClientConnected)({ host, port, username, password, tls, db });
|
|
153
|
+
const c = client;
|
|
154
|
+
for (let i = 0; i < items.length; i++) {
|
|
155
|
+
try {
|
|
156
|
+
const listId = this.getNodeParameter('listId', i);
|
|
157
|
+
const operation = this.getNodeParameter('operation', i);
|
|
158
|
+
const includeInputFields = this.getNodeParameter('includeInputFields', i, false);
|
|
159
|
+
let result;
|
|
160
|
+
if (operation === 'add') {
|
|
161
|
+
const valueStr = this.getNodeParameter('value', i, '');
|
|
162
|
+
const value = parseValue(valueStr);
|
|
163
|
+
const serialized = typeof value === 'string' ? value : JSON.stringify(value);
|
|
164
|
+
result = (await c.sendCommand(['RPUSH', listId, serialized]));
|
|
165
|
+
}
|
|
166
|
+
else if (operation === 'deleteValue') {
|
|
167
|
+
const valueStr = this.getNodeParameter('value', i, '');
|
|
168
|
+
const value = parseValue(valueStr);
|
|
169
|
+
const serialized = typeof value === 'string' ? value : JSON.stringify(value);
|
|
170
|
+
result = (await c.sendCommand(['LREM', listId, '0', serialized]));
|
|
171
|
+
}
|
|
172
|
+
else if (operation === 'deleteIndex') {
|
|
173
|
+
const index = this.getNodeParameter('index', i);
|
|
174
|
+
const script = `
|
|
175
|
+
local key = KEYS[1]
|
|
176
|
+
local index = tonumber(ARGV[1])
|
|
177
|
+
local sentinel = ARGV[2]
|
|
178
|
+
local exists = redis.call('LINDEX', key, index)
|
|
179
|
+
if exists then
|
|
180
|
+
redis.call('LSET', key, index, sentinel)
|
|
181
|
+
return redis.call('LREM', key, 1, sentinel)
|
|
182
|
+
else
|
|
183
|
+
return 0
|
|
184
|
+
end
|
|
185
|
+
`;
|
|
186
|
+
const sentinel = `__DELETED_${Math.random().toString(36).substring(2)}_${Date.now()}__`;
|
|
187
|
+
result = (await c.sendCommand(['EVAL', script, '1', listId, String(index), sentinel]));
|
|
188
|
+
}
|
|
189
|
+
else if (operation === 'replace') {
|
|
190
|
+
const index = this.getNodeParameter('index', i);
|
|
191
|
+
const valueStr = this.getNodeParameter('value', i, '');
|
|
192
|
+
const value = parseValue(valueStr);
|
|
193
|
+
const serialized = typeof value === 'string' ? value : JSON.stringify(value);
|
|
194
|
+
result = (await c.sendCommand(['LSET', listId, String(index), serialized]));
|
|
195
|
+
}
|
|
196
|
+
else if (operation === 'getAll') {
|
|
197
|
+
const start = this.getNodeParameter('rangeStart', i, 0);
|
|
198
|
+
const end = this.getNodeParameter('rangeEnd', i, -1);
|
|
199
|
+
const res = (await c.sendCommand(['LRANGE', listId, String(start), String(end)]));
|
|
200
|
+
result = res.map((s) => {
|
|
201
|
+
try {
|
|
202
|
+
return JSON.parse(s);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return s;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
else if (operation === 'clear') {
|
|
210
|
+
result = (await c.sendCommand(['DEL', listId]));
|
|
211
|
+
}
|
|
212
|
+
returnData.push({
|
|
213
|
+
json: includeInputFields
|
|
214
|
+
? { ...items[i].json, result }
|
|
215
|
+
: { result },
|
|
216
|
+
pairedItem: { item: i },
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
if (this.continueOnFail()) {
|
|
221
|
+
returnData.push({
|
|
222
|
+
json: { error: error.message },
|
|
223
|
+
pairedItem: { item: i },
|
|
224
|
+
});
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return [returnData];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
exports.BozonxRedisListSugar = BozonxRedisListSugar;
|
|
234
|
+
function parseValue(val) {
|
|
235
|
+
if (val === '')
|
|
236
|
+
return '';
|
|
237
|
+
try {
|
|
238
|
+
const parsed = (0, js_yaml_1.load)(val);
|
|
239
|
+
return parsed;
|
|
240
|
+
}
|
|
241
|
+
catch (yamlError) {
|
|
242
|
+
try {
|
|
243
|
+
return JSON.parse(val);
|
|
244
|
+
}
|
|
245
|
+
catch (jsonError) {
|
|
246
|
+
return val;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=BozonxRedisListSugar.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BozonxRedisListSugar.node.js","sourceRoot":"","sources":["../../../nodes/RedisListSugar/BozonxRedisListSugar.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,qCAA2C;AAC3C,+CAAwD;AAExD,MAAa,oBAAoB;IAAjC;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;YACtC,IAAI,EAAE,2BAA2B;YACjC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACT;oBACI,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACjB;aACJ;YACD,UAAU,EAAE;gBACR;oBACI,WAAW,EAAE,SAAS;oBACtB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,6BAA6B;iBAC7C;gBACD;oBACI,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,a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oin="round">
|
|
2
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" fill="#DC382D" stroke="none"/>
|
|
3
|
+
<line x1="8" y1="8" x2="16" y2="8" stroke="white" stroke-width="2"/>
|
|
4
|
+
<line x1="8" y1="12" x2="16" y2="12" stroke="white" stroke-width="2"/>
|
|
5
|
+
<line x1="8" y1="16" x2="16" y2="16" stroke="white" stroke-width="2"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface RedisConnectionOptions {
|
|
2
|
+
host: string;
|
|
3
|
+
port: number;
|
|
4
|
+
username?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
tls?: boolean;
|
|
7
|
+
db?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function getRedisClientConnected(opts: RedisConnectionOptions): Promise<unknown>;
|
|
10
|
+
export declare function calculateQueueTTL(timeoutSec: number): number;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getRedisClientConnected = getRedisClientConnected;
|
|
37
|
+
exports.calculateQueueTTL = calculateQueueTTL;
|
|
38
|
+
const timers_1 = require("timers");
|
|
39
|
+
const REDIS_CONNECT_DEADLINE_MS = 10000;
|
|
40
|
+
function withTimeout(promise, timeoutMs, message) {
|
|
41
|
+
let timeout;
|
|
42
|
+
return Promise.race([
|
|
43
|
+
promise,
|
|
44
|
+
new Promise((_, reject) => {
|
|
45
|
+
timeout = (0, timers_1.setTimeout)(() => reject(new Error(message)), timeoutMs);
|
|
46
|
+
}),
|
|
47
|
+
]).finally(() => {
|
|
48
|
+
if (timeout)
|
|
49
|
+
(0, timers_1.clearTimeout)(timeout);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const clients = new Map();
|
|
53
|
+
function buildUrl(opts) {
|
|
54
|
+
var _a;
|
|
55
|
+
const proto = opts.tls ? 'rediss' : 'redis';
|
|
56
|
+
const authPart = opts.username
|
|
57
|
+
? `${encodeURIComponent(opts.username)}:${encodeURIComponent((_a = opts.password) !== null && _a !== void 0 ? _a : '')}@`
|
|
58
|
+
: opts.password
|
|
59
|
+
? `:${encodeURIComponent(opts.password)}@`
|
|
60
|
+
: '';
|
|
61
|
+
const dbPath = typeof opts.db === 'number' ? `/${opts.db}` : '';
|
|
62
|
+
return `${proto}://${authPart}${opts.host}:${opts.port}${dbPath}`;
|
|
63
|
+
}
|
|
64
|
+
async function getRedisClientConnected(opts) {
|
|
65
|
+
const url = buildUrl(opts);
|
|
66
|
+
const cached = clients.get(url);
|
|
67
|
+
if (cached) {
|
|
68
|
+
if (cached.isOpen)
|
|
69
|
+
return cached;
|
|
70
|
+
try {
|
|
71
|
+
await withTimeout(cached.connect(), REDIS_CONNECT_DEADLINE_MS, `Redis reconnect timeout after ${REDIS_CONNECT_DEADLINE_MS}ms`);
|
|
72
|
+
return cached;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const { createClient } = await Promise.resolve().then(() => __importStar(require('redis')));
|
|
78
|
+
const client = createClient({
|
|
79
|
+
url,
|
|
80
|
+
disableOfflineQueue: true,
|
|
81
|
+
socket: {
|
|
82
|
+
connectTimeout: 10000,
|
|
83
|
+
reconnectStrategy: (retries) => {
|
|
84
|
+
return Math.min(retries * 100, 3000);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
client.on('error', () => {
|
|
89
|
+
});
|
|
90
|
+
await withTimeout(client.connect(), REDIS_CONNECT_DEADLINE_MS, `Redis connect timeout after ${REDIS_CONNECT_DEADLINE_MS}ms`);
|
|
91
|
+
clients.set(url, client);
|
|
92
|
+
return client;
|
|
93
|
+
}
|
|
94
|
+
function calculateQueueTTL(timeoutSec) {
|
|
95
|
+
return Math.max(Math.ceil(timeoutSec * 1.3), timeoutSec + 10);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=redisClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redisClient.js","sourceRoot":"","sources":["../../../nodes/RedisListSugar/redisClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,0DA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,UAAU,GAAG,GAAG,CAAC,EAAE,UAAU,GAAG,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -10,7 +10,7 @@ class BozonxRedisQueueComplete {
|
|
|
10
10
|
name: 'bozonxRedisQueueComplete',
|
|
11
11
|
group: ['transform'],
|
|
12
12
|
version: 1,
|
|
13
|
-
description: 'Release queue lock
|
|
13
|
+
description: 'Release queue lock (ESSENTIAL to allow next job to start) and check status',
|
|
14
14
|
defaults: { name: 'Redis Queue Complete' },
|
|
15
15
|
icon: 'file:redis-queue-complete.svg',
|
|
16
16
|
inputs: ['main'],
|
|
@@ -75,10 +75,10 @@ class BozonxRedisQueueComplete {
|
|
|
75
75
|
const jobId = String(this.getNodeParameter('jobId', i) || '').trim();
|
|
76
76
|
const includeInputFields = this.getNodeParameter('includeInputFields', i, false);
|
|
77
77
|
if (!queueId) {
|
|
78
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Queue ID is
|
|
78
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Queue ID is missing. Ensure the input data contains "queueId" (usually comes from the Redis Queue Trigger).', { itemIndex: i });
|
|
79
79
|
}
|
|
80
80
|
if (!jobId) {
|
|
81
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Job ID is
|
|
81
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Job ID is missing. Ensure the input data contains "jobId" (usually comes from the Redis Queue Trigger).', { itemIndex: i });
|
|
82
82
|
}
|
|
83
83
|
const queueKey = jobName ? `queue:${queueId}:${jobName}` : `queue:${queueId}`;
|
|
84
84
|
const lockKey = jobName ? `queue:${queueId}:${jobName}:lock` : `queue:${queueId}:lock`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BozonxRedisQueueComplete.node.js","sourceRoot":"","sources":["../../../nodes/RedisQueueComplete/BozonxRedisQueueComplete.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,+CAAwD;AAExD,MAAa,wBAAwB;IAArC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,sBAAsB;YACnC,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"BozonxRedisQueueComplete.node.js","sourceRoot":"","sources":["../../../nodes/RedisQueueComplete/BozonxRedisQueueComplete.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,+CAAwD;AAExD,MAAa,wBAAwB;IAArC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,sBAAsB;YACnC,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,4EAA4E;YACzF,QAAQ,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;YAC1C,IAAI,EAAE,+BAA+B;YACrC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,sBAAsB;oBAC/B,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,wCAAwC;iBACrD;gBACD;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,sBAAsB;oBAC/B,WAAW,EAAE,8DAA8D;iBAC3E;gBACD;oBACC,WAAW,EAAE,QAAQ;oBACrB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,oBAAoB;oBAC7B,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,6CAA6C;i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;gBACV,CAAC;gBACD,IAAI,KAAK,YAAY,iCAAkB,EAAE,CAAC;oBACzC,MAAM,KAAK,CAAC;gBACb,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YAChF,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AApJD,4DAoJC"}
|
|
@@ -9,7 +9,7 @@ class BozonxRedisQueueConsumer {
|
|
|
9
9
|
name: 'bozonxRedisQueueConsumer',
|
|
10
10
|
group: ['trigger'],
|
|
11
11
|
version: 1,
|
|
12
|
-
description: 'Process jobs from a Redis-based queue',
|
|
12
|
+
description: 'Process jobs from a Redis-based queue (one-by-one per Job Name)',
|
|
13
13
|
defaults: { name: 'Redis Queue Trigger' },
|
|
14
14
|
icon: 'file:redis-queue-consumer.svg',
|
|
15
15
|
inputs: [],
|
|
@@ -37,6 +37,16 @@ class BozonxRedisQueueConsumer {
|
|
|
37
37
|
placeholder: 'e.g., user-123, order-456',
|
|
38
38
|
description: 'Optional job name to group jobs within the same queue (must match the Job Name used in Redis Queue Add)',
|
|
39
39
|
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Polling Interval (ms)',
|
|
42
|
+
name: 'pollingInterval',
|
|
43
|
+
type: 'number',
|
|
44
|
+
default: 1000,
|
|
45
|
+
typeOptions: {
|
|
46
|
+
minValue: 100,
|
|
47
|
+
},
|
|
48
|
+
description: 'How long to wait (in milliseconds) before checking for the lock to be released or retrying an operation. Lower values increase responsiveness but also Redis CPU usage.',
|
|
49
|
+
},
|
|
40
50
|
],
|
|
41
51
|
usableAsTool: true,
|
|
42
52
|
};
|
|
@@ -56,6 +66,7 @@ class BozonxRedisQueueConsumer {
|
|
|
56
66
|
const jobName = String(this.getNodeParameter('jobName', 0) || '').trim();
|
|
57
67
|
const blpopTimeout = 60;
|
|
58
68
|
const lockTTL = 3600;
|
|
69
|
+
const pollingInterval = this.getNodeParameter('pollingInterval', 1000);
|
|
59
70
|
if (!queueId) {
|
|
60
71
|
const workflow = this.getWorkflow();
|
|
61
72
|
queueId = workflow.id || 'default-queue';
|
|
@@ -69,7 +80,7 @@ class BozonxRedisQueueConsumer {
|
|
|
69
80
|
try {
|
|
70
81
|
const lockExists = (await c.sendCommand(['EXISTS', lockKey]));
|
|
71
82
|
if (lockExists === 1) {
|
|
72
|
-
await new Promise((r) => setTimeout(r,
|
|
83
|
+
await new Promise((r) => setTimeout(r, pollingInterval));
|
|
73
84
|
continue;
|
|
74
85
|
}
|
|
75
86
|
if (!running)
|
|
@@ -102,7 +113,7 @@ class BozonxRedisQueueConsumer {
|
|
|
102
113
|
]);
|
|
103
114
|
if (!acquired) {
|
|
104
115
|
await c.sendCommand(['LPUSH', queueKey, jobData]);
|
|
105
|
-
await new Promise((r) => setTimeout(r,
|
|
116
|
+
await new Promise((r) => setTimeout(r, pollingInterval));
|
|
106
117
|
continue;
|
|
107
118
|
}
|
|
108
119
|
const result = {
|
|
@@ -115,7 +126,7 @@ class BozonxRedisQueueConsumer {
|
|
|
115
126
|
}
|
|
116
127
|
catch (error) {
|
|
117
128
|
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.error(`Error in queue consumer loop: ${error.message}`);
|
|
118
|
-
await new Promise((r) => setTimeout(r,
|
|
129
|
+
await new Promise((r) => setTimeout(r, pollingInterval));
|
|
119
130
|
continue;
|
|
120
131
|
}
|
|
121
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BozonxRedisQueueConsumer.node.js","sourceRoot":"","sources":["../../../nodes/RedisQueueConsumer/BozonxRedisQueueConsumer.node.ts"],"names":[],"mappings":";;;AAOA,+CAAwD;AAQxD,MAAa,wBAAwB;IAArC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"BozonxRedisQueueConsumer.node.js","sourceRoot":"","sources":["../../../nodes/RedisQueueConsumer/BozonxRedisQueueConsumer.node.ts"],"names":[],"mappings":";;;AAOA,+CAAwD;AAQxD,MAAa,wBAAwB;IAArC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE;YACzC,IAAI,EAAE,+BAA+B;YACrC,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,wCAAwC;oBACrD,WAAW,EACV,8FAA8F;iBAC/F;gBACD;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,2BAA2B;oBACxC,WAAW,EACV,yGAAyG;iBAC1G;gBAED;oBACC,WAAW,EAAE,uBAAuB;oBACpC,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,IAAI;oBACb,WAAW,EAAE;wBACZ,QAAQ,EAAE,GAAG;qBACb;oBACD,WAAW,EACV,yKAAyK;iBAC1K;aACD;YACD,YAAY,EAAE,IAAI;SAClB,CAAC;IAmLH,CAAC;IAjLA,KAAK,CAAC,OAAO;;QACZ,MA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CAAI,OAAO,CAAC;oBAG1D,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,WAAW,CAAC;wBACpC,KAAK;wBACL,OAAO;wBACP,GAAG;wBACH,IAAI;wBACJ,IAAI;wBACJ,MAAM,CAAC,gBAAgB,CAAC;qBACxB,CAAC,CAAC;oBAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAEf,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;wBAClD,OAAO;oBACR,CAAC;oBAED,MAAM,MAAM,GAAgB;wBAC3B,IAAI,EAAE,aAAa,CAAC,IAAmB;wBACvC,OAAO;wBACP,OAAO,EAAE,OAAO,IAAI,IAAI;wBACxB,KAAK,EAAE,aAAa,CAAC,KAAK;qBAC1B,CAAC;oBAEF,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;gBACrC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CAAC,4BAA6B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC5E,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD;AArOD,4DAqOC"}
|
|
@@ -11,7 +11,7 @@ class BozonxRedisQueueProducer {
|
|
|
11
11
|
name: 'bozonxRedisQueueProducer',
|
|
12
12
|
group: ['output'],
|
|
13
13
|
version: 1,
|
|
14
|
-
description: 'Add jobs to a Redis-based queue',
|
|
14
|
+
description: 'Add jobs to a Redis-based queue for strictly sequential processing',
|
|
15
15
|
defaults: { name: 'Redis Queue Add' },
|
|
16
16
|
icon: 'file:redis-queue-producer.svg',
|
|
17
17
|
inputs: ['main'],
|
|
@@ -54,9 +54,9 @@ class BozonxRedisQueueProducer {
|
|
|
54
54
|
displayName: 'Lock TTL (seconds)',
|
|
55
55
|
name: 'lockTTL',
|
|
56
56
|
type: 'number',
|
|
57
|
-
default:
|
|
57
|
+
default: 60,
|
|
58
58
|
typeOptions: { minValue: 1 },
|
|
59
|
-
description: 'Maximum allowed processing time for the job. If the job
|
|
59
|
+
description: 'Maximum allowed processing time for the job. If the job doesn\'t finish within this time, the queue will "unfreeze" after this TTL expires. Set this as low as possible to avoid long lockups.',
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
displayName: 'Response Timeout (seconds)',
|
|
@@ -126,7 +126,8 @@ class BozonxRedisQueueProducer {
|
|
|
126
126
|
else {
|
|
127
127
|
dataObj = dataParam;
|
|
128
128
|
}
|
|
129
|
-
const
|
|
129
|
+
const executionId = this.getExecutionId();
|
|
130
|
+
const jobId = `${queueId}:${executionId}:${i}:${Math.random().toString(36).substring(2, 7)}`;
|
|
130
131
|
const jobPayload = {
|
|
131
132
|
jobId,
|
|
132
133
|
data: dataObj,
|