Skip to content
Snippets Groups Projects
Commit c739ee9f authored by Michele Alberti's avatar Michele Alberti
Browse files

[Ivette/server] Use undefined instead of null.

parent 956db744
No related branches found
No related tags found
No related merge requests found
...@@ -153,20 +153,20 @@ let queueId: string[] = []; ...@@ -153,20 +153,20 @@ let queueId: string[] = [];
/** Polling timeout and timer. */ /** Polling timeout and timer. */
const pollingTimeout = 50; const pollingTimeout = 50;
let pollingTimer: NodeJS.Timeout | null = null; let pollingTimer: NodeJS.Timeout | undefined;
/** Flushing timer. */ /** Flushing timer. */
let flushingTimer: NodeJS.Immediate | null = null; let flushingTimer: NodeJS.Immediate | undefined;
/** Server process. */ /** Server process. */
let process: ChildProcess | null = null; let process: ChildProcess | undefined;
/** Killing timeout and timer for server process hard kill. */ /** Killing timeout and timer for server process hard kill. */
const killingTimeout = 300; const killingTimeout = 300;
let killingTimer: NodeJS.Timeout | null = null; let killingTimer: NodeJS.Timeout | undefined;
/** ZMQ (REQ) socket. */ /** ZMQ (REQ) socket. */
let zmqSocket: ZmqRequest | null = null; let zmqSocket: ZmqRequest | undefined;
/** Flag on whether ZMQ socket is busy. */ /** Flag on whether ZMQ socket is busy. */
let zmqIsBusy = false; let zmqIsBusy = false;
...@@ -543,15 +543,15 @@ function _reset() { ...@@ -543,15 +543,15 @@ function _reset() {
pending = {}; pending = {};
if (flushingTimer) { if (flushingTimer) {
clearImmediate(flushingTimer); clearImmediate(flushingTimer);
flushingTimer = null; flushingTimer = undefined;
} }
if (pollingTimer) { if (pollingTimer) {
clearTimeout(pollingTimer); clearTimeout(pollingTimer);
pollingTimer = null; pollingTimer = undefined;
} }
if (killingTimer) { if (killingTimer) {
clearTimeout(killingTimer); clearTimeout(killingTimer);
killingTimer = null; killingTimer = undefined;
} }
} }
...@@ -588,10 +588,10 @@ function _exit(error?: Error) { ...@@ -588,10 +588,10 @@ function _exit(error?: Error) {
_reset(); _reset();
if (zmqSocket) { if (zmqSocket) {
zmqSocket.close(); zmqSocket.close();
zmqSocket = null; zmqSocket = undefined;
} }
zmqIsBusy = false; zmqIsBusy = false;
process = null; process = undefined;
if (status.stage === Stage.RESTARTING) { if (status.stage === Stage.RESTARTING) {
setImmediate(start); setImmediate(start);
} else if (error) { } else if (error) {
...@@ -846,7 +846,7 @@ function _waiting() { ...@@ -846,7 +846,7 @@ function _waiting() {
function _flush() { function _flush() {
if (!flushingTimer) { if (!flushingTimer) {
flushingTimer = setImmediate(() => { flushingTimer = setImmediate(() => {
flushingTimer = null; flushingTimer = undefined;
_send(); _send();
}); });
} }
...@@ -856,7 +856,7 @@ function _poll() { ...@@ -856,7 +856,7 @@ function _poll() {
if (!pollingTimer) { if (!pollingTimer) {
const delay = (config && config.polling) || pollingTimeout; const delay = (config && config.polling) || pollingTimeout;
pollingTimer = setTimeout(() => { pollingTimer = setTimeout(() => {
pollingTimer = null; pollingTimer = undefined;
_send(); _send();
}, delay); }, delay);
} }
......
...@@ -46,7 +46,7 @@ class PP { ...@@ -46,7 +46,7 @@ class PP {
// --- Synchronized Current Project // --- Synchronized Current Project
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
let currentProject: string | null = null; let currentProject: string | undefined;
let states: any = {}; let states: any = {};
const stateDefaults: any = {}; const stateDefaults: any = {};
...@@ -107,12 +107,12 @@ export async function setProject(project: string) { ...@@ -107,12 +107,12 @@ export async function setProject(project: string) {
// --- Projectified State // --- Projectified State
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
function getValue(id: string, project: string | null) { function getValue(id: string, project?: string) {
if (!project) return undefined; if (!project) return undefined;
return _.get(states, [project, id], stateDefaults[id]); return _.get(states, [project, id], stateDefaults[id]);
} }
function setValue(id: string, project: string | null, value: any) { function setValue(id: string, project: string | undefined, value: any) {
if (!project) return; if (!project) return;
_.set(states, [project, id], value); _.set(states, [project, id], value);
Dome.emit(STATE + id, value); Dome.emit(STATE + id, value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment