Open dynamicdan opened 9 years ago
Current progress is that files are no longer checked on startup and 0 byte files are ignored in sync once downloaded. A message explains the steps to take (restart cmd line tool, add content to file, done).
The current error handling system could be adjusted to adopt solution 2 (see above).
@dynamicdan so whats the ask here. Find the code that downloads the file, if the file size is 0 bytes give it a name of __name.ext?
It's been a while since I thought about this. Perhaps it's now possible to identify this scenario and handle it. We could save info in the meta file that a record was downloaded as 0 bytes. Then update the various functions. Could avoid messing with file names.
If a ui action has no content in the script field then the download will be "" or 0 bytes. The system will think it hasn't been downloaded and try and request each time you start the tool.
There is no known work around other than being a smarter user... Why are they downloaded scripts of 0 bytes?... add something once downloaded and the problem is gone!
SOLUTION 1:
Potentially we can resolve this issue by saving "sync data" that the last downloaded remote version was 0 bytes and therefore ignore the file during startup. We would need to reset the sync data for this file if the record changed on the server to have content. We would then always check for special sync data before trying to download a record for the first time.
SOLUTION 2:
Check the timestamp when the 0 bytes file was created. If the time is more than 5 seconds in the past then assume that it has already been processed and the record should stay as 0 bytes. Potentially delete the local 0 bytes file to save on processing checks OR simply rename to signify that it has been skipped: "
MyEmptyScript.js
" => "__MyEmptyScript.js
" and then ignore files starting with "__
".