ldn-inbox-server
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -20,3 +20,3 @@ #!/usr/bin/env node | ||
.name('lnd-inbox-server') | ||
.version('1.1.2') | ||
.version('1.1.3') | ||
.description('A demonstration Event Notifications Inbox server'); | ||
@@ -39,2 +39,3 @@ | ||
.command('handler') | ||
.option('--loop <seconds>', 'run in a loop',0) | ||
.option('--inbox <inbox>','inbox',INBOX_PATH) | ||
@@ -58,5 +59,13 @@ .option('--outbox <outbox>','outbox',OUTBOX_PATH) | ||
} | ||
await handle_inbox(box,options); | ||
if (options['loop']) { | ||
while(1) { | ||
await handle_inbox(box,options); | ||
await new Promise(resolve => setTimeout(resolve, options['loop']*1000)); | ||
} | ||
} | ||
else { | ||
await handle_inbox(box,options); | ||
} | ||
}); | ||
program.parse(); |
@@ -7,3 +7,3 @@ const fs = require('fs'); | ||
logger.info(`parsing notification ${path}`); | ||
throw Error('eeee'); | ||
try { | ||
@@ -10,0 +10,0 @@ const json = JSON.parse(fs.readFileSync(path, { encoding: 'utf-8'})); |
@@ -19,7 +19,6 @@ const fs = require('fs'); | ||
const handler = dynamic_handler(options['notification_handler'],null); | ||
console.log(glob); | ||
fs.readdir(path, (err,files) => { | ||
files.forEach( (file) => { | ||
const fullPath = `${path}/${file}`; | ||
console.log(file); | ||
if (file.match(glob)) { | ||
@@ -29,3 +28,9 @@ // Process | ||
.then( async (release) => { | ||
await handler(fullPath,options); | ||
try { | ||
await handler(fullPath,options); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
logger.error(`handler failed on ${fullPath}`); | ||
} | ||
return release(); | ||
@@ -32,0 +37,0 @@ }) |
{ | ||
"name": "ldn-inbox-server", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A demonstration Event Notifications Inbox server", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
20901
466