google / cloud-print-connector

Google Cloud Print Connector
BSD 3-Clause "New" or "Revised" License
764 stars 184 forks source link

Don't delete printers on PPD Errors (Issue #366) #417

Closed korylprince closed 6 years ago

korylprince commented 6 years ago

I was recently bitten by Issue #366 after upgrading to the latest version (after being on a very old version.)

This PR implements a mostly similar fix as mentioned in that issue.

I wouldn't call this the best fix, as it treats unknown errors when fetching a PPD as a cache hit, but I think this is far better than the current alternative of just returning an error and causing the printer (with all sharing information) to be deleted.

An eventual ideal implementation would have the ability to detect errors and mark printers as offline instead of the white/black keep/delete approach. I didn't delve too far into the code, but it doesn't look like there's any mechanisms like that right now.

I hope you'll still accept this PR in the meantime, though, as the current code can be very destructive.

korylprince commented 6 years ago

In further testing, this is not sufficient to stop the printer from being deleted. I'm delving further to see what's going on.

korylprince commented 6 years ago

Okay, after further testing, it appears that the issue in #366 (at least the error 1280 No printer-uri found) only happens when using the connector with CUPS_SERVER to point it to a server on another host.

I've had the connector running on the same host as the CUPS server for over a day and this hasn't happened once. While this is a disappointing result, at least it is a valid workaround.

I'll close this PR because it really didn't end up helping.