-
Notifications
You must be signed in to change notification settings - Fork 0
🧹 Make PrinterDiscovery cache TTL configurable #12
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -43,7 +43,8 @@ type Environment struct { | |||||
| Verbose bool | ||||||
|
|
||||||
| // Impresora | ||||||
| DefaultPrinter string | ||||||
| DefaultPrinter string | ||||||
| PrinterCacheTTL time.Duration | ||||||
|
||||||
| PrinterCacheTTL time.Duration | |
| PrinterCacheTTL time.Duration // Duration to cache printer discovery results |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||
| package daemon | ||||||||||
|
|
||||||||||
| import ( | ||||||||||
| "testing" | ||||||||||
| "time" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| func TestNewPrinterDiscovery(t *testing.T) { | ||||||||||
| ttl := 10 * time.Second | ||||||||||
| pd := NewPrinterDiscovery(ttl) | ||||||||||
| if pd.cacheTTL != ttl { | ||||||||||
| t.Errorf("expected cacheTTL %v, got %v", ttl, pd.cacheTTL) | ||||||||||
|
Comment on lines
+11
to
+12
|
||||||||||
| if pd.cacheTTL != ttl { | |
| t.Errorf("expected cacheTTL %v, got %v", ttl, pd.cacheTTL) | |
| if pd == nil { | |
| t.Errorf("expected non-nil PrinterDiscovery from NewPrinterDiscovery") |
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 change from
../posterto./mock_posterappears unintentional and problematic. The original../posterreplace directive suggests a local development setup with the poster repository located alongside this one. Changing it to./mock_posterwould expect a mock_poster directory in the current repository root, which doesn't appear to exist based on the directory listing.This change will break builds unless:
If this change was intentional for testing, it should not be committed to the main branch. If it was accidental (perhaps made to enable local testing), it should be reverted to
../poster.