fix(com): raise serial timeout 800ms -> 3000ms and make it configurable per address#205
fix(com): raise serial timeout 800ms -> 3000ms and make it configurable per address#205shizoxy wants to merge 2 commits into
Conversation
…per address Slow fiscal devices (e.g. Daisy PerfectS) pause longer than 800ms between SYN (0x16) bytes while writing a receipt to fiscal memory. The hardcoded 800ms read/write timeout then raises E107 'no response', the driver aborts the receipt (АНУЛИРАН БОН) and reports failure even though the receipt may already be recorded in fiscal memory. - DefaultTimeout raised to 3000ms - Address format extended to <Com>[:<Speed>[:<TimeoutMs>]], e.g. com://COM5:115200:5000, so future slow devices are fixed by configuration instead of a rebuild Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks for the detailed write-up - the underlying problem is real and worth solving. However, I'm closing this PR as-is; a few points need to be sorted out first, ideally in an issue:
Please open an issue so we can align on the design. Thanks for reporting it. |
|
Btw, it makes a lot of sense for auto-detection timeout to be decoupled from command response timeout. Apparently 800 ms (which is almost double 500 ms what Daisy+Datecs recommend) timeout between device responses does not correspond to reality while a much smaller timeout (less than 50 ms) for auto-detection would suffice is most cases. Besides failing auto-detection is not like failing critical close receipt command i.e. it has some merrit to be faster in general. Just my $.02 |
Problem
Slow fiscal devices pause longer than 800ms between SYN (0x16) bytes while committing a receipt to fiscal memory on close. With the hardcoded 800ms
ReadTimeout/WriteTimeoutinComTransport, the read loop times out,ParseResponseraises E107 "no response", and the ISL driver subsequently aborts the receipt — the device prints АНУЛИРАН БОН (cancelled receipt) even though the receipt may already be recorded in fiscal memory.We reproduced this in production with a Daisy PerfectS (firmware ONL01AZ_EUR-1.0BG) on
bg.dy.isl.com://COM5:Timeout occured while writing to com port 'COM5'immediately after port open (35 occurrences in a single day's log)ok:false/ E107Fix
DefaultTimeoutraised 800ms → 3000ms. The keep-alive/idle close timer already uses 3000ms, so an idle open port is disposed on the same schedule as before; normal responses still return in milliseconds — only genuinely slow devices benefit.<Com>[:<Speed>[:<TimeoutMs>]], e.g.com://COM5:115200:5000. Fully backward compatible — existingCOM5/COM5:115200addresses behave as before (with the new default).Testing
Happy to adjust the default value or the address syntax if you prefer a different approach (e.g. appsettings-based timeout).