Skip to content

Commit db4d97b

Browse files
committed
Bug Fix: Crasher in monitoring subsystem when storage transactions are disabled. Fixes #220.
1 parent 460ed0b commit db4d97b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/monitor.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,17 @@ class Monitoring {
589589
var update_data = null;
590590
var last_item = null;
591591
var trans = null;
592+
var use_trans = !!this.config.getPath('Storage.transactions');
592593

593594
async.series(
594595
[
595596
function(callback) {
596-
// begin transaction
597+
// begin transaction if enabled, otherwise use direct storage
598+
if (!use_trans) {
599+
trans = self.storage;
600+
return callback();
601+
}
602+
597603
self.storage.begin( timeline_key, function(err, transaction) {
598604
trans = transaction;
599605
callback();
@@ -684,12 +690,15 @@ class Monitoring {
684690
},
685691
function(callback) {
686692
// commit our transaction
693+
if (!use_trans) return callback();
687694
trans.commit(callback);
688695
}
689696
],
690697
function(err) {
691698
if (err) {
692699
// abort transaction and bubble error up
700+
if (!use_trans) return callback(err);
701+
693702
return trans.abort( function() {
694703
callback(err);
695704
} );

0 commit comments

Comments
 (0)