heston / label-commander

Google Assistant + Raspberry Pi + Dymo LabelWriter = label nirvana!
MIT License
5 stars 0 forks source link

Cache printed labels for 30 seconds to prevent double printing #2

Closed heston closed 6 years ago

heston commented 6 years ago

When issuing subsequent voice commands close together, sometimes the same label will print more than once. This is a race condition where the listener gets a new update before the print handler has had a chance to mark the previous label as printed.

This change caches successfully printed labels for 30 seconds, and skips printing any that are in the cache.