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

Add elapsed time and finish time to Printer Status #510

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Add elapsed time and finish time to Printer Status #510

wants to merge 14 commits into from

Conversation

fcollingwood
Copy link
Contributor

Screen Shot 2022-02-02 at 5 03 25 PM

Copy link
Owner

@luizribeiro luizribeiro left a 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.

Comment on lines +144 to +147
timestamp_file = config.get_cache_directory() + '/timestamp.txt'
f = open(timestamp_file,"w")
f.write(str(int(time.time())))
f.close()
Copy link
Owner

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:

  1. We will run into issues with prints which were started from other sources (e.g. from the printer itself).
  2. 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 from mariner.server.api - so it seems like we're mixing the roles of each module.
  3. 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

Copy link
Contributor Author

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 fcollingwood@gmail.com

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

Successfully merging this pull request may close these issues.

None yet

2 participants