-
Notifications
You must be signed in to change notification settings - Fork 69
Add elapsed time and finish time to Printer Status #510
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
base: master
Are you sure you want to change the base?
Conversation
fcollingwood
commented
Feb 2, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comment, I think we need to make some architectural changes before we consider supporting elapsed time - otherwise this will cause a bunch of bugs.
timestamp_file = config.get_cache_directory() + '/timestamp.txt' | ||
f = open(timestamp_file,"w") | ||
f.write(str(int(time.time()))) | ||
f.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit hacky 😅 You are basically doing this so you can later on figure out when the printing was started, right?
Here's some thoughts I have on the current implementation:
- We will run into issues with prints which were started from other sources (e.g. from the printer itself).
- This is doing a write to the filesystem from
mariner.printer
, which is meant really to just interface with the printer. The removal of the state file is happening frommariner.server.api
- so it seems like we're mixing the roles of each module. - This will create all sorts of bugs with things like: if we start a print from the UI and then never come back to it, the state file won't get deleted. If we start a print from the printer and open the UI, we won't have a state file.
I feel like if we want to build this functionality correctly, we should create some sort of internal in-memory state for the server. Probably a second thread which is responsible for doing all communication with the printer and also responsible for polling the printer for its status - so that if a print is started from the printer we will get to know about it. This is something which I have been interested in for a while but haven't had the time to build: see #75 if you're interested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very valid points.
BTW, congrats on getting it back to a building state - I have no idea what you did, but I would like to know.
I need to have a chat with you privately about this and a few other things I have in mind, however I have no way of getting in touch with you. Could you please drop me an email on [email protected]