Skip to content

Commit

Permalink
fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Serphentas committed Jan 5, 2018
1 parent 25f7924 commit 5c5e54e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/GraphiteClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ GraphiteClient.flatten = function(obj, flat, prefix) {

GraphiteClient.prototype.write = function(metrics, timestamp, cb) {
if (typeof timestamp === 'function') {
cb = timestamp;
timestamp = null;
cb = timestamp;
timestamp = undefined;
}

timestamp = timestamp || Date.now();
timestamp = Math.floor(timestamp / 1000);
if (timestamp === undefined) {
timestamp = Math.floor(Date.now() / 1000);
}

this._carbon.write(GraphiteClient.flatten(metrics), timestamp, cb);
};
Expand Down

0 comments on commit 5c5e54e

Please sign in to comment.