Compare commits
2 Commits
1.2.3
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
| c6c2b40f37 | |||
| 8f093159cd |
@ -296,20 +296,19 @@ func (c *Client) DispenserStart(ctx context.Context) (string, error) {
|
||||
return stockStatus, fmt.Errorf("[%s] to encoder: %w", funcName, err)
|
||||
}
|
||||
|
||||
deadline := time.Now().Add(3 * time.Second)
|
||||
deadline := time.Now().Add(6 * time.Second)
|
||||
|
||||
for {
|
||||
time.Sleep(delay * 2)
|
||||
if time.Now().After(deadline) {
|
||||
return stockStatus, fmt.Errorf("[%s] timeout waiting keycard at encoder position", funcName)
|
||||
return stockStatus, nil
|
||||
}
|
||||
|
||||
status, err = c.do(ctx, cmdStatus)
|
||||
if err != nil {
|
||||
return stockStatus, fmt.Errorf("[%s] re-check status: %w", funcName, err)
|
||||
}
|
||||
status, _ = c.do(ctx, cmdStatus)
|
||||
|
||||
stockStatus = stockTake(status)
|
||||
c.setStock(status)
|
||||
logStatus(status)
|
||||
|
||||
// error states first
|
||||
if isCardWellEmpty(status) {
|
||||
@ -319,8 +318,6 @@ func (c *Client) DispenserStart(ctx context.Context) (string, error) {
|
||||
if isAtEncoderPosition(status) {
|
||||
return stockStatus, nil
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,8 +330,13 @@ 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)
|
||||
status, err := c.do(ctx, cmdStatus)
|
||||
if err == nil && len(status) >= 4 {
|
||||
c.setStock(status)
|
||||
}
|
||||
|
||||
time.Sleep(delay)
|
||||
if err := c.ToEncoder(ctx); err != nil {
|
||||
return stockStatus, fmt.Errorf("[%s] to encoder: %w", funcName, err)
|
||||
}
|
||||
@ -343,30 +345,26 @@ func (c *Client) DispenserFinal(ctx context.Context) (string, error) {
|
||||
logStatus(status)
|
||||
}()
|
||||
|
||||
deadline := time.Now().Add(3 * time.Second)
|
||||
deadline := time.Now().Add(6 * time.Second)
|
||||
|
||||
for {
|
||||
time.Sleep(delay * 2)
|
||||
if time.Now().After(deadline) {
|
||||
return stockStatus, nil
|
||||
}
|
||||
|
||||
status, err := c.do(ctx, cmdStatus)
|
||||
if err != nil {
|
||||
return stockStatus, nil
|
||||
}
|
||||
status, _ = c.do(ctx, cmdStatus)
|
||||
|
||||
stockStatus = stockTake(status)
|
||||
c.setStock(status)
|
||||
logStatus(status)
|
||||
|
||||
if isCardWellEmpty(status) {
|
||||
return stockStatus, fmt.Errorf(stockStatus)
|
||||
return stockStatus, nil
|
||||
}
|
||||
|
||||
if isAtEncoderPosition(status) {
|
||||
return stockStatus, nil
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -191,6 +191,7 @@ func (app *App) takePayment(w http.ResponseWriter, r *http.Request) {
|
||||
writeTransactionResult(w, http.StatusServiceUnavailable, theResponse)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if r.Method == http.MethodOptions {
|
||||
|
||||
2
main.go
2
main.go
@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
buildVersion = "1.2.3"
|
||||
buildVersion = "1.2.5"
|
||||
serviceName = "hardlink"
|
||||
pollingFrequency = 8 * time.Second
|
||||
)
|
||||
|
||||
@ -2,6 +2,12 @@
|
||||
|
||||
builtVersion is a const in main.go
|
||||
|
||||
#### 1.2.5 - 20 March 2026
|
||||
removed early return on error when checking dispenser status in the start and final loops.
|
||||
|
||||
#### 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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user