This commit is contained in:
parent
ed35aab63b
commit
1075e8d466
@ -204,7 +204,7 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
console.log('make a check worker: ', path.resolve(__dirname, 'check.js'))
|
console.log('make a check worker: ', path.resolve(__dirname, 'check.js'))
|
||||||
|
|
||||||
const worker = new Worker(winURL)
|
const worker = new Worker(winURL)
|
||||||
worker.onError = function(e) {
|
worker.onerror = function(e) {
|
||||||
worker.terminate()
|
worker.terminate()
|
||||||
worker.view.max = 0
|
worker.view.max = 0
|
||||||
worker.view.checkDialogVisible = false
|
worker.view.checkDialogVisible = false
|
||||||
|
@ -74,6 +74,16 @@
|
|||||||
|
|
||||||
const worker = new Worker(winURL)
|
const worker = new Worker(winURL)
|
||||||
console.log(fileUrl('src/renderer/utils/worker.js'))
|
console.log(fileUrl('src/renderer/utils/worker.js'))
|
||||||
|
worker.onerror = function (e) {
|
||||||
|
console.error(e)
|
||||||
|
worker.terminate()
|
||||||
|
worker.scanning = false
|
||||||
|
worker.view.progress = 0
|
||||||
|
worker.view.max = 0
|
||||||
|
worker.view.worker = null
|
||||||
|
clearInterval(this.polling)
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
worker.scanning = this.scanning
|
worker.scanning = this.scanning
|
||||||
worker.max = this.max
|
worker.max = this.max
|
||||||
@ -121,6 +131,16 @@
|
|||||||
|
|
||||||
const worker = new Worker(winURL)
|
const worker = new Worker(winURL)
|
||||||
console.log(fileUrl('src/renderer/utils/worker.js'))
|
console.log(fileUrl('src/renderer/utils/worker.js'))
|
||||||
|
worker.onerror = function (e) {
|
||||||
|
console.error(e)
|
||||||
|
worker.terminate()
|
||||||
|
worker.scanning = false
|
||||||
|
worker.view.progress = 0
|
||||||
|
worker.view.max = 0
|
||||||
|
worker.view.worker = null
|
||||||
|
clearInterval(this.polling)
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
worker.scanning = this.scanning
|
worker.scanning = this.scanning
|
||||||
worker.max = this.max
|
worker.max = this.max
|
||||||
@ -169,6 +189,16 @@
|
|||||||
|
|
||||||
const worker = new Worker(winURL)
|
const worker = new Worker(winURL)
|
||||||
console.log(fileUrl('src/renderer/utils/worker.js'))
|
console.log(fileUrl('src/renderer/utils/worker.js'))
|
||||||
|
worker.onerror = function (e) {
|
||||||
|
console.error(e)
|
||||||
|
worker.terminate()
|
||||||
|
worker.scanning = false
|
||||||
|
worker.view.progress = 0
|
||||||
|
worker.view.max = 0
|
||||||
|
worker.view.worker = null
|
||||||
|
clearInterval(this.polling)
|
||||||
|
e.preventDefault()
|
||||||
|
}
|
||||||
this.scanning = true
|
this.scanning = true
|
||||||
worker.scanning = this.scanning
|
worker.scanning = this.scanning
|
||||||
worker.max = this.max
|
worker.max = this.max
|
||||||
|
@ -16,6 +16,8 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
* @param {*} callback
|
* @param {*} callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const { Debugger } = require("electron");
|
||||||
|
|
||||||
async function asyncForEach(array, callback) {
|
async function asyncForEach(array, callback) {
|
||||||
logger('info', "AsyncForEach Len " + array.length);
|
logger('info', "AsyncForEach Len " + array.length);
|
||||||
for (let index = 0; index < array.length; index++) {
|
for (let index = 0; index < array.length; index++) {
|
||||||
@ -46,7 +48,7 @@ async function scanGroundnetFiles(p, features) {
|
|||||||
try {
|
try {
|
||||||
logger('info', 'Start Groundnets ' + p);
|
logger('info', 'Start Groundnets ' + p);
|
||||||
var files = traverseDir(p);
|
var files = traverseDir(p);
|
||||||
this.postMessage(['max', files.length]);
|
this.postMessage(['max', files.length*2]);
|
||||||
logger('info', files);
|
logger('info', files);
|
||||||
|
|
||||||
asyncForEach(files, async f => {
|
asyncForEach(files, async f => {
|
||||||
@ -376,6 +378,7 @@ function store(icao, airlines, value) {
|
|||||||
async function readGroundnet(f, features) {
|
async function readGroundnet(f, features) {
|
||||||
var promise = new Promise(function (resolve, reject) {
|
var promise = new Promise(function (resolve, reject) {
|
||||||
try {
|
try {
|
||||||
|
var thisPostMessage = this.postMessage;
|
||||||
var filename = path.basename(f).match('^([^.]+)\\.([^.]+)(\\.new)?\\.([^.]+)');
|
var filename = path.basename(f).match('^([^.]+)\\.([^.]+)(\\.new)?\\.([^.]+)');
|
||||||
if (filename == null) {
|
if (filename == null) {
|
||||||
resolve("File didn't match");
|
resolve("File didn't match");
|
||||||
@ -470,12 +473,10 @@ async function readGroundnet(f, features) {
|
|||||||
}
|
}
|
||||||
if(filename [3] === '.new') {
|
if(filename [3] === '.new') {
|
||||||
feature['properties']['wipgroundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
feature['properties']['wipgroundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
||||||
//debugger;
|
|
||||||
feature['properties']['wipparking'] = parkingnodes && parkingnodes.Parking ? parkingnodes.Parking.length : 0;
|
feature['properties']['wipparking'] = parkingnodes && parkingnodes.Parking ? parkingnodes.Parking.length : 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
feature['properties']['groundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
feature['properties']['groundnet'] = nodes && nodes.node ? nodes.node.length : 0;
|
||||||
//debugger;
|
|
||||||
feature['properties']['parking'] = parkingnodes && parkingnodes.Parking ? parkingnodes.Parking.length : 0;
|
feature['properties']['parking'] = parkingnodes && parkingnodes.Parking ? parkingnodes.Parking.length : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,6 +491,7 @@ async function readGroundnet(f, features) {
|
|||||||
// report on the success of the transaction completing, when everything is done
|
// report on the success of the transaction completing, when everything is done
|
||||||
transaction.oncomplete = function (event) {
|
transaction.oncomplete = function (event) {
|
||||||
logger('info', 'Write Transaction complete ' + event);
|
logger('info', 'Write Transaction complete ' + event);
|
||||||
|
thisPostMessage(['progress', 1]);
|
||||||
resolve("Stored " + filename[1]);
|
resolve("Stored " + filename[1]);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -512,7 +514,7 @@ async function readGroundnet(f, features) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
objectStoreRequest.onerror = function (event) {
|
objectStoreRequest.onerror = function (event) {
|
||||||
logger('info', "Read Errpr : " + event);
|
logger('info', "Read Error : " + event);
|
||||||
resolve(event);
|
resolve(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user