added check if keycard at the encoder position before trying to encode key

This commit is contained in:
yurii 2026-03-18 17:08:40 +00:00
parent e1549dda2f
commit 9f87736cab
3 changed files with 7 additions and 7 deletions

View File

@ -299,6 +299,7 @@ func (c *Client) DispenserStart(ctx context.Context) (string, error) {
deadline := time.Now().Add(3 * time.Second)
for {
time.Sleep(delay)
if time.Now().After(deadline) {
return stockStatus, fmt.Errorf("[%s] timeout waiting keycard at encoder position", funcName)
}
@ -319,8 +320,6 @@ func (c *Client) DispenserStart(ctx context.Context) (string, error) {
if isAtEncoderPosition(status) {
return stockStatus, nil
}
time.Sleep(100 * time.Millisecond)
}
}
@ -333,7 +332,7 @@ func (c *Client) DispenserFinal(ctx context.Context) (string, error) {
return stockStatus, fmt.Errorf("[%s] out of mouth: %w", funcName, err)
}
time.Sleep(200 * time.Millisecond)
time.Sleep(delay * 2)
if err := c.ToEncoder(ctx); err != nil {
return stockStatus, fmt.Errorf("[%s] to encoder: %w", funcName, err)
@ -346,6 +345,7 @@ func (c *Client) DispenserFinal(ctx context.Context) (string, error) {
deadline := time.Now().Add(3 * time.Second)
for {
time.Sleep(delay)
if time.Now().After(deadline) {
return stockStatus, nil
}
@ -365,8 +365,5 @@ func (c *Client) DispenserFinal(ctx context.Context) (string, error) {
if isAtEncoderPosition(status) {
return stockStatus, nil
}
time.Sleep(100 * time.Millisecond)
}
}

View File

@ -29,7 +29,7 @@ import (
)
const (
buildVersion = "1.2.3"
buildVersion = "1.2.4"
serviceName = "hardlink"
pollingFrequency = 8 * time.Second
)

View File

@ -2,6 +2,9 @@
builtVersion is a const in main.go
#### 1.2.4 - 18 March 2026
added check if keycard at the encoder position before trying to encode key
#### 1.2.3 - 17 March 2026
added check if keycard at the encoder position before trying to encode key