aboutsummaryrefslogtreecommitdiff
path: root/featureClass
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-04-19 00:16:51 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-04-19 00:16:51 +0800
commit51ae30d794ffd362779b44420c305871d63891ba (patch)
tree187bc27fb862a037c5388140a5acefce5455d219 /featureClass
parentc87c6f2703d689375518f54905ae10e2edb42d41 (diff)
downloadSoopyV2-51ae30d794ffd362779b44420c305871d63891ba.tar.gz
SoopyV2-51ae30d794ffd362779b44420c305871d63891ba.tar.bz2
SoopyV2-51ae30d794ffd362779b44420c305871d63891ba.zip
optimisations to threads
Diffstat (limited to 'featureClass')
-rw-r--r--featureClass/featureManager.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js
index 982c106..2c52c7b 100644
--- a/featureClass/featureManager.js
+++ b/featureClass/featureManager.js
@@ -110,6 +110,18 @@ class FeatureManager {
if (this.isDev) {
this.registerStep(true, 2, () => {
+
+ key = this.watchService.take();
+ let moduleToReload = this.watches[key]
+ if (this.features[moduleToReload] && !this.reloadingModules.includes(moduleToReload)) { //if enabled && not alr in queue
+ this.reloadingModules.push(moduleToReload)
+ this.reloadModuleTime = Date.now() + 5000
+ }
+ key.pollEvents()/*.forEach(event=>{
+ console.log(event.context().toString())
+ })*/
+ key.reset();
+
if (this.reloadModuleTime !== 0 && Date.now() - this.reloadModuleTime > 0) {
new Thread(() => {
this.reloadModuleTime = 0
@@ -129,20 +141,6 @@ class FeatureManager {
this.watchService = Java.type("java.nio.file.FileSystems").getDefault().newWatchService();
this.reloadingModules = []
this.reloadModuleTime = 0
- new Thread(() => {
- while (this.enabled) {
- key = this.watchService.take();
- let moduleToReload = this.watches[key]
- if (this.features[moduleToReload] && !this.reloadingModules.includes(moduleToReload)) { //if enabled && not alr in queue
- this.reloadingModules.push(moduleToReload)
- this.reloadModuleTime = Date.now() + 5000
- }
- key.pollEvents()/*.forEach(event=>{
- console.log(event.context().toString())
- })*/
- key.reset();
- }
- }).start()
}
this.registerCommand("soopyunloadfeature", (args) => {