]> git.sesse.net Git - remoteglot/blobdiff - server/serve-analysis.js
Fix a deadlock in the JSON loading code in serve-analysis.js.
[remoteglot] / server / serve-analysis.js
index 0490e96f604a2639102aa62cc572320208b23fe7..22bc20d337d1585cb99df43e41519d0ff67ac1c5 100644 (file)
@@ -40,6 +40,13 @@ if (process.argv.length >= 6) {
        port = parseInt(process.argv[5]);
 }
 
+// gRPC backends.
+var grpc_backends = ["localhost:50051", "localhost:50052"];
+if (process.argv.length >= 7) {
+       grpc_backends = process.argv[6].split(",");
+}
+hash_lookup.init(grpc_backends);
+
 // If set to 1, we are already processing a JSON update and should not
 // start a new one. If set to 2, we are _also_ having one in the queue.
 var json_lock = 0;
@@ -138,7 +145,7 @@ var reread_file = function(event, filename) {
        if (json_lock == 1) {
                // Already processing; wait a bit.
                json_lock = 2;
-               setTimeout(function() { json_lock = 1; reread_file(event, filename); }, 100);
+               setTimeout(function() { if (json_lock == 2) json_lock = 1; reread_file(event, filename); }, 100);
                return;
        }
        json_lock = 1;