f
This commit is contained in:
parent
2561febca9
commit
935344d581
8
app.py
8
app.py
@ -80,18 +80,18 @@ def print_address_label(pdf_path):
|
||||
cut=True
|
||||
)
|
||||
|
||||
# Try to acquire the printer lock with a timeout
|
||||
# Try to acquire the printer lock with a longer timeout
|
||||
max_retries = 3
|
||||
retry_delay = 2 # seconds
|
||||
retry_delay = 10 # 10 seconds retry delay
|
||||
for attempt in range(max_retries):
|
||||
if printer_lock.acquire(timeout=5): # 5 seconds timeout
|
||||
if printer_lock.acquire(timeout=30): # 30 seconds timeout to allow more time for the printer
|
||||
try:
|
||||
app.logger.info(f"Attempting to send print job (Attempt {attempt + 1})...")
|
||||
send(
|
||||
instructions=instructions,
|
||||
printer_identifier=printer,
|
||||
backend_identifier=backend,
|
||||
blocking=True
|
||||
blocking=True # Ensure blocking, so we wait for the print to complete
|
||||
)
|
||||
app.logger.info("Print job sent successfully")
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user