Search for Content in Files triggers OnChange Event in apps
Posted: 26 May 2016 00:48
I code in many languages, but because logic is universal I prefer to use Garry's Mod using a C style Lua / GLua... One thing about the game is that it auto-refreshed the scripts when a change has been applied to a file ( the file was saved )... I also wrote my own autoloader system which handles the load-order instead of hard-coding the include and AddCSLuaFile ( send salted-compressed file to client so they have it to include ) and I added other features so if 2 auto-refresh events are triggered at the same time ( or while another load is still under-way ), it'll only load the first time..
The issue is there are over 1000 files all organized in a neat folder-structure by extensions of existing code, extensions to existing meta-tables, libraries ( new meta-tables / class-like objects that can be closed which can have static vars, or public ), content, etc...
When using the search feature inside of XYplorer to search all files inside the folder, including subfolders etc..., for specific content.. XYplorer triggers an on-change event for each of the files, so I end up with the auto-refresh system thinking that 1000 files are being refreshed and with the loader it has to logically check whether or not to load those 1000 files 1000 times ( or it may be linked to the number of data it finds per file PLUS each file it searches because even if something is found in only 1 file several times it still triggers the on-change event for all of the files )...
The way I coded it, as explained above, is if a load is currently in progress then it'll simply skip trying to process any of the files for inclusion... But, the search takes time and including 1000 files also takes a few seconds so by it spamming the on-change events, XY is still forcing the system to include the files over the course of however long it takes to run the search meaning out of the 1000 files, while on change is triggered that many times the actual inclusion system may run 100 or more times because the on-change is triggered at different times ( the system is based on time so if all of the changes were triggered at once, which isn't feasible, it'd deny 999 of the 1000; but it isn't so as soon as a load cycle completes the next one starts )...
I haven't checked all of the available timestamps ( created, modified, accessed ) but the created and modified timestamps remained the same, ie unchanged... so something else is causing the on-change event to be triggered in other software and it would be great to have that resolved!
The issue is there are over 1000 files all organized in a neat folder-structure by extensions of existing code, extensions to existing meta-tables, libraries ( new meta-tables / class-like objects that can be closed which can have static vars, or public ), content, etc...
When using the search feature inside of XYplorer to search all files inside the folder, including subfolders etc..., for specific content.. XYplorer triggers an on-change event for each of the files, so I end up with the auto-refresh system thinking that 1000 files are being refreshed and with the loader it has to logically check whether or not to load those 1000 files 1000 times ( or it may be linked to the number of data it finds per file PLUS each file it searches because even if something is found in only 1 file several times it still triggers the on-change event for all of the files )...
The way I coded it, as explained above, is if a load is currently in progress then it'll simply skip trying to process any of the files for inclusion... But, the search takes time and including 1000 files also takes a few seconds so by it spamming the on-change events, XY is still forcing the system to include the files over the course of however long it takes to run the search meaning out of the 1000 files, while on change is triggered that many times the actual inclusion system may run 100 or more times because the on-change is triggered at different times ( the system is based on time so if all of the changes were triggered at once, which isn't feasible, it'd deny 999 of the 1000; but it isn't so as soon as a load cycle completes the next one starts )...
I haven't checked all of the available timestamps ( created, modified, accessed ) but the created and modified timestamps remained the same, ie unchanged... so something else is causing the on-change event to be triggered in other software and it would be great to have that resolved!