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

Tern server.reset isn't deleting files #60

Closed
MiguelCastillo opened this issue Apr 15, 2013 · 5 comments
Closed

Tern server.reset isn't deleting files #60

MiguelCastillo opened this issue Apr 15, 2013 · 5 comments

Comments

@MiguelCastillo
Copy link

Is server.reset supposed to delete all the files? If it is supposed to, then we have a bug.

@marijnh
Copy link
Member

marijnh commented Apr 16, 2013

This is the intended behavior. reset flushes the type graph, but keeps the files that were added around. It is indended to be a thing that happens silently in the background when the graph has gotten messy from too many purge/analyze cycles, and shouldn't have visible side effects except for possibly cleaner results in the next request.

@marijnh marijnh closed this as completed Apr 16, 2013
@MiguelCastillo
Copy link
Author

The primary use case I am looking at is switching projects; most likely data does not carry from project to project. So, I am manually setting server.files = [] when switching projects; I am also calling reset as that seemed like a natural call to make. Perhaps reset and clearing all files (along with whatever else you might want to clean up) can be put in a function? Maybe clear(), clearAll()? I don't your preference.

I am not big into making pull request for such small items, but if you would like I can add a clear function and make a pull request for ya. Or if you have a better approach, I would really like to hear about it.

@marijnh
Copy link
Member

marijnh commented Apr 18, 2013

Create a new server for each project. I don't think there's anything added by being able to re-purpose an existing server object.

@MiguelCastillo
Copy link
Author

Alright, simple enough. I am always skeptical about creating new objects that are called "server", which is why I didn't do it before. But if you are suggesting it, then it must be safe to do :-)

Thanks!

@marijnh
Copy link
Member

marijnh commented Apr 18, 2013

Yes, definitely safe. This is not a singleton, and there's no global data involved.

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

No branches or pull requests

2 participants