Fix data enrichment before print, Timezone, and add UI#1
Open
BobbyLindsey wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses premature label printing by deferring print attempts until print-start events have complete enrichment data (duration/filament/ETA), and adjusts label timestamp formatting to display in the system’s local timezone.
Changes:
- Add a wait/defer workflow so labels aren’t printed until events are sufficiently enriched, plus a periodic “pending labels” pass to print deferred events once data arrives.
- Improve print-job ↔ event matching by allowing more flexible filename compatibility checks.
- Update label timestamp rendering to convert timestamps to the local timezone, and add new configuration/env settings for the wait/defer behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/printerprinter/storage.py | Adds a helper to check whether a label job attempt exists for an event. |
| src/printerprinter/main.py | Implements defer/wait logic before printing, adds pending label processing, and relaxes filename matching rules. |
| src/printerprinter/labeling.py | Converts displayed timestamps to local timezone (treating naive timestamps as UTC). |
| src/printerprinter/config.py | Adds settings for label wait window, poll interval during wait, and max age for pending labels. |
| README.md | Documents new environment variables controlling label wait/defer behavior. |
| .env.example | Adds example values for the new environment variables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
1
to
+3
| from __future__ import annotations | ||
|
|
||
| from datetime import datetime | ||
| from datetime import UTC, datetime |
| limit: int = 50, | ||
| ) -> int: | ||
| recent_events = list_recent_print_start_events(db_path, limit=limit) | ||
| now = datetime.now(UTC) |
Comment on lines
+663
to
+667
| event_row = await _wait_for_event_data( | ||
| client, | ||
| db_path, | ||
| event_id=int(result["event"]["id"]), | ||
| timeout_seconds=label_wait_seconds, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an issue where the label would print before all data was received. Fixed data collection also.
Fixed issue where it would always use UTC. Now uses local timezone.