Skip to content

Commit ca3077b

Browse files
committed
Fixed issue with snapshot
1 parent c4c304a commit ca3077b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/actions/select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ function init(cfg) {
3030
* @param msg incoming message object that contains ``body`` with payload
3131
* @param cfg configuration that is account information and configuration field values
3232
*/
33-
function processAction(msg, cfg, snapshot) {
33+
function processAction(msg, cfg, snapshot = {}) {
3434
const originalSql = cfg.query;
3535
const now = new Date().toISOString();
3636
// Last poll should come from Snapshot, if not it's beginning of time
37-
const lastPoll = snapshot ? snapshot.lastPoll : null || new Date(0).toISOString();
37+
const lastPoll = snapshot.lastPoll || new Date(0).toISOString();
3838
console.log('Last polling timestamp=%s', lastPoll);
3939
const sql = originalSql.split(LAST_POLL_PLACEHOLDER).join(lastPoll);
4040
console.log('Original query=%s', originalSql);

spec-integration/integration.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('Integration test', () => {
114114
const msg = {
115115
body: {}
116116
};
117-
select.process.call(emitter, msg, cfg).catch(err => done(err));
117+
select.process.call(emitter, msg, cfg, {}).catch(err => done(err));
118118
});
119119
});
120120

0 commit comments

Comments
 (0)