Commit 50afa10e3d668b231915cca2a9847f6b32d993a0
1 parent
2be1f1f4e4
Exists in
master
Include ts on sms file
Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff
lib/transport.js
1 | 1 | const fs = require('fs'); |
2 | +const moment = require('moment'); | |
3 | +const uniqid = require('uniqid'); | |
4 | + | |
2 | 5 | const config = require('komodo-sdk/config'); |
3 | 6 | const logger = require('komodo-sdk/logger'); |
4 | -const uniqid = require('uniqid'); | |
5 | 7 | |
6 | 8 | async function send(partner, msg) { |
7 | 9 | if (typeof partner !== 'string' || typeof msg !== 'string') return; |
... | ... | @@ -15,7 +17,8 @@ ${msg.trim()} |
15 | 17 | `.trim(); |
16 | 18 | |
17 | 19 | const dir = config.outbox_dir || '/var/spool/sms/outgoing'; |
18 | - const filename = `${dir}/komodo.${uniqid()}`; | |
20 | + const ts = moment().format('YYYYMMDD_HHmmss.SSS'); | |
21 | + const filename = `${dir}/komodo.${ts}.${uniqid()}`; | |
19 | 22 | |
20 | 23 | fs.exists(dir, (isExists) => { |
21 | 24 | if (!isExists) { |