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

Logger generate file operation errors #10

Open
sarthou opened this issue Apr 16, 2021 · 4 comments
Open

Logger generate file operation errors #10

sarthou opened this issue Apr 16, 2021 · 4 comments
Assignees

Comments

@sarthou
Copy link
Contributor

sarthou commented Apr 16, 2021

Due to asynchronous events (I think), we can enter into a situation where an operation on the file tries to be made while the file is not open.

To reproduce it, click anywhere multiple time, at a moment the robot will stop moving because of this issue.

@sarthou
Copy link
Contributor Author

sarthou commented Apr 16, 2021

https://github.com/VictorB00/Simulation-Factory-Godot/blob/ad6c1c74aa4883f1a5b80381698e54d1a41e5d35/Scripts/Main.gd#L83-L91

Moreover, opening, seeking for the end, and closing a file each time you want to write a line is a too heavy job. You should rather only write once at the end or periodically by detaching a dedicated process for it.

@sarthou sarthou changed the title Logger remains stuck Logger generate file operation errors Apr 16, 2021
@sarthou
Copy link
Contributor Author

sarthou commented Apr 16, 2021

The fact that the robot is stuck is due to the battery (it is thus a wanted feature) and not the logger. Nevertheless, the logger generates an error at each event.

@VictorB00 VictorB00 self-assigned this Apr 20, 2021
@VictorB00
Copy link
Contributor

Changed the logger to save the text in a string and only write at the end (when the simulation is closed)

@VictorB00
Copy link
Contributor

Removed the logging process from Main node to put it in a dedicated singleton which can be accessed from anywhere to log information, and automatically saves the data to file at a fixed interval

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