Slightly improved error handling, some heuristics for number of cores to build with, and misc. work in progress changes.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3246 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2016-06-12 13:45:57 +00:00
parent 61ea965080
commit ef1fa591e5
4 changed files with 28 additions and 5 deletions

View File

@ -121,7 +121,13 @@ function invoke(handlers, argv) {
var promises = [];
if (handlers) {
for (var i = 0; i < handlers.length; ++i) {
try {
promises.push(handlers[i].apply({}, argv));
} catch (error) {
handlers.splice(i, 1);
i--;
promises.push(new Promise(function(resolve, reject) { reject(error); }));
}
}
}
return Promise.all(promises);

View File

@ -233,6 +233,11 @@ function updateWindows() {
function updateConversation() {
if (gCurrentConversation) {
terminal.cork();
terminal.clear();
terminal.print("...");
terminal.uncork();
Promise.all([
gCurrentConversation.session.getHistory(gCurrentConversation.name),
gCurrentConversation.session.getParticipants(gCurrentConversation.name),
@ -405,7 +410,7 @@ function formatMessage(message) {
var result;
if (typeof message == "string") {
for (let i = 0; i < message.length; i++) {
if (message.charCodeAt(i) > 128 && message.charCodeAt(i) < 256) {
if (message.charCodeAt(i) >= 128 /*&& message.charCodeAt(i) < 256*/) {
message = message.substring(0, i) + "?" + message.substring(i + 1);
}
}

View File

@ -48,7 +48,12 @@ exports.ChatService = class {
for (let i = self._callbacks.length - 1; i >= 0; i--) {
let callback = self._callbacks[i];
try {
callback(message);
callback(message).catch(function(error) {
self._callbacks.splice(i, 1);
// XXX: Send it to the other connections?
print(error);
});
} catch (error) {
self._callbacks.splice(i, 1);

View File

@ -1,6 +1,8 @@
#!/usr/bin/python -u
import multiprocessing
import os
import platform
import shutil
import stat
import subprocess
@ -26,6 +28,11 @@ kV8Repository = 'https://github.com/v8/v8.git'
kV8Branch = 'branch-heads/5.1'
kV8Work = 'v8'
cores = multiprocessing.cpu_count()
if platform.machine() == 'armv7l':
cores = 1
print 'Using', cores, 'cores.'
def run(*args, **kw):
print 'Running:', args, kw
subprocess.check_call(*args, **kw)
@ -63,7 +70,7 @@ def updateUv():
if sys.platform == 'linux2':
run(['./gyp_uv.py', '-f', 'make'], cwd=kUvWork)
run(['make', '-j8', '-C', 'out'], cwd=kUvWork)
run(['make', '-j' + str(cores), '-C', 'out'], cwd=kUvWork)
elif sys.platform == 'darwin':
run(['./gyp_uv.py', '-f', 'xcode'], cwd=kUvWork)
run(['xcodebuild', '-ARCHS="x86_64"', '-project', 'uv.xcodeproj', '-configuration', 'Release', '-target', 'All'], cwd=kUvWork)
@ -116,7 +123,7 @@ def updateV8():
run(['gclient' + extension, 'sync'], cwd=kV8Work)
if sys.platform == 'linux2':
run(['make', '-j4', 'native'], cwd=kV8Work)
run(['make', '-j' + str(cores), 'native'], cwd=kV8Work)
elif sys.platform == 'darwin':
run(['build/gyp_v8', '-Dtarget_arch=x64'], cwd=kV8Work)
run(['xcodebuild', '-project', 'build/all.xcodeproj', '-configuration', 'Release'], cwd=kV8Work)