Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
Fix memory leak in dbinterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Clark committed May 12, 2015
1 parent 4541973 commit f201a2e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions api/lib/db-interface.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

var _ = require('lodash');
var util = require('util');
var assert = require('assert');
var knex = require('knex');
Expand Down Expand Up @@ -208,9 +208,8 @@ DI.saveTransaction = function(transaction, callback) {

if (this.lock[txData.client_resource_id]) {
// Force synchronous per-transaction updates
/* eslint-disable max-len */
this.once(unlockEvent, this.saveTransaction.bind(this, transaction, callback));
/* eslint-enable max-len */
var handler = _.partial(this.saveTransaction, transaction, callback);
this.once(unlockEvent, handler);
return;
}

Expand Down Expand Up @@ -246,7 +245,7 @@ DI.saveTransaction = function(transaction, callback) {
(callback || noop)(err);
})
.finally(function() {
self.lock[txData.client_resource_id] = null;
delete self.lock[txData.client_resource_id];
self.emit(unlockEvent);
});
};
Expand Down

0 comments on commit f201a2e

Please sign in to comment.