Merge branch 'florianbrede-ayet:main' into main

pull/4/head
Adam Black 2021-05-22 22:24:37 +01:00
commit 7cc8eca375
2 changed files with 29 additions and 2 deletions

View File

@ -1,5 +1,7 @@
# retropilot-server
replacement for comma.ai backend and useradmin dashboard. can be combined with a modified cabana instance.
Replacement for comma.ai backend and useradmin dashboard. can be combined with a modified cabana build.
If you don't want to host your own instance, check out https://api.retropilot.org/useradmin for a hosted version of the backend, useradmin and cabana.
### [Server] Summary

View File

@ -198,6 +198,7 @@ var segmentProcessPosition=0;
var affectedDrives={};
var affectedDevices={};
var rlog_lastTsInternal=0;
var rlog_prevLatInternal=-1000;
var rlog_prevLngInternal=-1000;
@ -208,6 +209,7 @@ var rlog_prevLngExternal=-1000;
var rlog_totalDistExternal = 0;
var qcamera_duration = 0;
function processSegmentRLog(rLogPath) {
rlog_lastTsInternal=0;
@ -221,9 +223,23 @@ function processSegmentRLog(rLogPath) {
return new Promise(
function(resolve, reject) {
var readStream = fs.createReadStream(rLogPath);
var temporaryFile = rLogPath.replace(".bz2", "");
try {
execSync(`bunzip2 -k "${rLogPath}"`);
}
catch (exception) { // if bunzip2 fails, something was wrong with the file (corrupt / missing)
logger.error(exception);
try {fs.unlinkSync(temporaryFile);} catch (exception) {}
resolve();
return;
}
var readStream = fs.createReadStream(temporaryFile);
var reader = Reader(readStream);
readStream.on('close', function () {
logger.info("processSegmentRLog readStream close event triggered, resolving promise");
try {fs.unlinkSync(temporaryFile);} catch (exception) {}
resolve();
});
@ -630,6 +646,15 @@ function mainWorkerLoop() {
}
// make sure bunzip2 is available
try {
execSync(`bunzip2 --version`);
}
catch (exception) {
logger.error("bunzip2 is not installed or not available in environment path")
process.exit();
}
lockfile.lock('retropilot_worker.lock', { realpath: false, stale: 90000, update: 2000 })
.then((release) => {