Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const CFG_PATH = path.join(PATH, 'config');

(async () => {
const config = await new Config(CFG_PATH);
const { sections } = config;
const count = sections.server.ports.length;
const count = config.sections.server.ports.length;
const workers = new Array(count);

const start = id => {
Expand Down
9 changes: 5 additions & 4 deletions static/metacom.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export class Metacom {
const packet = JSON.parse(data);
const { callback, event } = packet;
const callId = callback || event;
const [resolve, reject] = this.calls.get(callId);
const promised = this.calls.get(callId);
if (!promised) return;
const [resolve, reject] = promised;
if (packet.error) {
const { code, message } = packet.error;
const error = new Error(message);
Expand Down Expand Up @@ -39,9 +41,8 @@ export class Metacom {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(packet),
}).then(res => {
const { status } = res;
if (status === 200) return res.json().then(({ result }) => result);
throw new Error(`Status Code: ${status}`);
if (res.status === 200) return res.json().then(({ result }) => result);
throw new Error(`Status Code: ${res.status}`);
});
};
}
Expand Down