Compare View
Commits (2)
Changes
Showing 3 changed files Side-by-side Diff
lib/webhook-sender.js
... | ... | @@ -17,10 +17,10 @@ const sleepBeforeRetryMs = Number(config.webhook && config.webhook.sleep_before_ |
17 | 17 | || DEFAULT_SLEEP_BEFORE_RETRY_MS; |
18 | 18 | |
19 | 19 | const baseDumpDir = path.join('dump', 'webhook-sender'); |
20 | + | |
20 | 21 | if (!fs.existsSync(baseDumpDir)) { |
21 | 22 | fs.mkdirSync(baseDumpDir, { recursive: true }); |
22 | 23 | } |
23 | -const lastDumpFileName = path.join(baseDumpDir, 'last.json'); | |
24 | 24 | |
25 | 25 | const sleepMs = (ms) => new Promise((resolve) => { |
26 | 26 | setTimeout(() => { |
... | ... | @@ -41,13 +41,15 @@ const dumper = async (xid, webhookType, body) => { |
41 | 41 | 'json', |
42 | 42 | ].filter((item) => item).join('.'); |
43 | 43 | |
44 | + // write dump file | |
44 | 45 | await fs.promises.writeFile( |
45 | 46 | path.join(baseDumpDir, filename), |
46 | 47 | stringify({ webhookType, body }), |
47 | 48 | ); |
48 | 49 | |
50 | + // write last dump file | |
49 | 51 | await fs.promises.writeFile( |
50 | - lastDumpFileName, | |
52 | + path.join(baseDumpDir, ['last', webhookType].join('.')), | |
51 | 53 | stringify({ webhookType, body }), |
52 | 54 | ); |
53 | 55 | } catch (e) { |
package-lock.json
1 | 1 | { |
2 | 2 | "name": "komodo-center-httpget-x", |
3 | - "version": "0.18.8", | |
3 | + "version": "0.18.9", | |
4 | 4 | "lockfileVersion": 2, |
5 | 5 | "requires": true, |
6 | 6 | "packages": { |
7 | 7 | "": { |
8 | 8 | "name": "komodo-center-httpget-x", |
9 | - "version": "0.18.8", | |
9 | + "version": "0.18.9", | |
10 | 10 | "license": "ISC", |
11 | 11 | "dependencies": { |
12 | 12 | "axios": "^1.7.3", |