[FAILING] Cleanup and formatting

pull/1446/head
Rick Carlino 2019-09-17 16:45:40 -05:00
parent d8a5458142
commit 4dde181488
4 changed files with 5 additions and 34 deletions

View File

@ -1,31 +1,6 @@
import { getStatus } from "../reducer_support";
// import moment from "moment";
// import { ConnectionStatus } from "../interfaces";
// RELEVANT:
// https://en.wikipedia.org/wiki/Now_and_Later
const NOW = "Tue, 03 Oct 2017 09:00:00 -0500";
// const LATER = "Wed, 04 Oct 2017 09:00:00 -0500";
// const LATER_JSON = moment(LATER).toDate().getTime();
const NOW_UNIX = (new Date(NOW)).getTime();
// describe("computeBestTime()", () => {
// const STUB: ConnectionStatus = { state: "down", at: NOW_UNIX };
// it("returns same input when `last_saw_mq` is unavailable", () => {
// expect(computeBestTime(undefined, undefined)).toBe(undefined);
// expect(computeBestTime(STUB, undefined)).toBe(STUB);
// const hmm = computeBestTime(undefined, LATER);
// expect(hmm && hmm.at).toEqual(LATER_JSON);
// });
// it("computes best time when enough information is present", () => {
// const expected: ConnectionStatus = { state: "down", at: LATER_JSON };
// expect(computeBestTime(STUB, LATER)).toEqual(expected);
// });
// });
const NOW_UNIX =
(new Date("Tue, 03 Oct 2017 09:00:00 -0500")).getTime();
describe("getStatus()", () => {
it("returns 'down' when not given enough data", () => {
expect(getStatus(undefined)).toBe("down");

View File

@ -98,11 +98,7 @@ export const batchInitResources =
return { type: Actions.BATCH_INIT, payload };
};
export const bothUp = () => {
dispatchNetworkUp("user.mqtt", now());
// WHO IS USING THIS? Best if we let the ping util handle it now.
// dispatchNetworkUp(" bot.mqtt", now());
};
export const bothUp = () => dispatchNetworkUp("user.mqtt", now());
export function readStatus() {
const noun = "'Read Status' command";

View File

@ -19,7 +19,7 @@ export const networkUptimeThrottleStats: Record<Edge, number> = {
function shouldThrottle(edge: Edge, now: number): boolean {
if (edge === "bot.mqtt") {
return true;
return true; // Let PING_OK / PING_NO handle bot.mqtt stuff.
}
const then = networkUptimeThrottleStats[edge];
const diff = now - then;

View File

@ -37,7 +37,7 @@ export let connectivityReducer =
})
.add<EdgeStatus>(Actions.NETWORK_EDGE_CHANGE, (s, { payload }) => {
if (payload.name == "bot.mqtt") {
return s;
return s; // <= Let PING_OK / PING_NO handle it.
} else {
s.uptime[payload.name] = payload.status;
return s;