Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #643 from jyotman/remove-moment
Browse files Browse the repository at this point in the history
remove moment as a dependency
  • Loading branch information
mcollina authored May 20, 2017
2 parents 26233af + 4240bed commit 45303eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions lib/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ OTHER DEALINGS IN THE SOFTWARE.

"use strict";

var moment = require("moment");
var movingAverage = require("moving-average");
var version = "mosca " + require("../package").version;

Expand Down Expand Up @@ -159,8 +158,6 @@ Stats.prototype.wire = function wire(server) {
});
}

var mom = moment(this.started);

var timer = setInterval(function() {
var stats = server.stats;
var mem = process.memoryUsage();
Expand All @@ -179,7 +176,7 @@ Stats.prototype.wire = function wire(server) {

doPublish("version", version);
doPublish("started_at", server.stats.started.toISOString());
doPublish("uptime", mom.from(Date.now(), true));
doPublish("uptime", Math.ceil((Date.now() - server.stats.started) / 1000) + ' seconds');
doPublish("clients/maximum", stats.maxConnectedClients);
doPublish("clients/connected", stats.connectedClients);
doPublish("publish/received", stats.publishedMessages);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"lru-cache": "~4.0.0",
"memdown": "~1.1.1",
"minimatch": "~3.0.0",
"moment": "~2.13.0",
"moving-average": "0.1.1",
"mqtt": "^1.6.3",
"mqtt-connection": "^2.1.1",
Expand Down
4 changes: 2 additions & 2 deletions test/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe("mosca.Stats", function() {
it("should publish the uptime every 10s", function(done) {
server.on("testPublished", function(packet) {
if (packet.topic === "$SYS/42/uptime") {
expect(packet.payload).to.eql("a few seconds");
expect(packet.payload).to.eql("10 seconds");
done();
}
});
Expand All @@ -294,7 +294,7 @@ describe("mosca.Stats", function() {

server.on("testPublished", function func(packet) {
if (packet.topic === "$SYS/42/uptime" &&
packet.payload === "3 minutes") {
packet.payload === "180 seconds") {
server.removeListener("testPublished", func);
done();
}
Expand Down

0 comments on commit 45303eb

Please sign in to comment.