Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave function create .tmp files into /weio #270

Closed
ementi opened this issue Nov 19, 2015 · 8 comments
Closed

Autosave function create .tmp files into /weio #270

ementi opened this issue Nov 19, 2015 · 8 comments
Assignees
Milestone

Comments

@ementi
Copy link

ementi commented Nov 19, 2015

When I get any kind of error with my weio, there are a lot of " *.tmp " files created in the root.
I am talking about a couple hundred in a few minutes.

@ks156
Copy link
Contributor

ks156 commented Nov 19, 2015

What's the content of these files ? Can you paste one here ?

@ementi
Copy link
Author

ementi commented Nov 19, 2015

The content is my code. Exactly my Code of my main.py and index.html. Like Copy & Paste.

@ementi
Copy link
Author

ementi commented Nov 19, 2015

Update: Not just when an error occurs. They seem to be randomly created. Not at every error, just sometimes. AND not every time but sometimes when running a program.

@ks156 ks156 changed the title Temporary Files created when Error Occured Autosave function create .tmp files into /weio Nov 19, 2015
@ks156
Copy link
Contributor

ks156 commented Nov 19, 2015

The autosave function create a temporary file each 4 seconds. This is really bad for the flash memory.
In addition, in some cases (I didn't find the conditions yet), the temporary files are not moved or deleted, probably due to this exception which only catch on NameError.

A solution must be found quickly to fix this problem.

@ks156 ks156 added this to the v1.3 milestone Nov 19, 2015
@drasko
Copy link
Contributor

drasko commented Nov 19, 2015

@ukicar please think to completely disable autosave function. Saving all the time something to the flash wears the flash, as it has a limited number of writes. If something has to be saved temporarely, you must always use RAM.

But I think for this purpose, it would be best to remove auto-save option all together.

@nmarcetic opinions?

@ks156
Copy link
Contributor

ks156 commented Nov 19, 2015

👍 to remove auto-save

We can keep the CTRL-S function, and modify writeRawContentToFile either that way

def saveRawContentToFile(path, data):
    try :
        inputFile = open(path, 'w')
        print(inputFile)
        ret = inputFile.write(data)
        inputFile.close()
    except:
        return -1

    return 0

or that way :

def saveRawContentToFile(path, data):
    tmp = "/tmp/"+str(uuid.uuid1())+".tmp"

    try :
        inputFile = open(tmp, 'w')
        print(inputFile)
        ret = inputFile.write(data)
        inputFile.close()
    except:
        os.remove(tmp)
        return -1

    move(tmp, path)
    return 0

@ukicar
Copy link

ukicar commented Nov 20, 2015

This is extremely critical bug. I decided to really deactivate autoSave as it's not really necessary. When we want to play it will save, when we want to change the project it will save it first (I just added this feature) and when we preview it will save it. Finally we can manually save by CTRL-S. It's pretty enough i think

Thanks Paul for your propositions specially about saving to the temp before copying to the flash (I integrated that too).

Deactivating AutoSave in JS
1a7bde3

Save project before changing the project or creating new etc..
b34f037

Copy to the /tmp before copying to the flash
9b33cdc

@ks156 @drasko For me it's OK I tested. Please confirm that is ok before closing this bug

@ks156
Copy link
Contributor

ks156 commented Nov 22, 2015

Ok for me. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants